|
yup - can't override the TraceListener.Dispose method. You have to override the Dispose( bool ) method which i've done and had no luck with. Stupid Dispose!
|
|
|
|
|
OK - So I figured out a solution, but I have to determine the impact. The worker thread IsBackground property had been set to false, mainly to increase performance. (This is supposed to be part of a high-performance, low impact auditing framework we are writing) I'm going to make the assumption that the Trace framework, waits for all non-background threads to complete before calling close.
Thanks for the help...
|
|
|
|
|
Glad you found a solution, but I still question the Dispose use. Have you actually put a " : IDisposable" at the end of your class definition? If not, you can do that and then supply at minumum an IDisposable.Dispose() implementation. This will be separate from any dependency upon being able to inherit from TraceListener, but you may need to call the base.Dispose() method to properly clean things up.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Hello,
I have created a non-rectangular form using a GraphicsPath and regions.
Now, I have code that can move the form, but I do not know how to resize the form.
Do I have to somehow know when the user hovers the mouse over the edge of the form to resize it?
Can anyone help me out?
Thanx a lot
-Flack
|
|
|
|
|
I assume that you are already handling the WM_NCHITTEST message in order to move the form. If so, you need to also define a routine that can detect whether the mouse is in one of the 8 different edge areas of the window. WM_NCHITTEST documentation lists the possible return values. (If you are not handling WM_NCHITTEST, you'll need to do these things manually, but the principles are the same.)
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Hello there,
I have a problem : I have to display large amounts of pictures in 1 Container (in my situation a Panel).So far so good...But when I start to zoom on this Panel the Height property can only get to 32767 (because its an int-type). So I can't vieuw the entire content any more... (its parent is a scrollable control)
Also when I zoom out again it seems that i lose some of (or parts of) my pictures that where outside of the reachable area.
Is there a way to solve/go round this problem?
I hope someone can help me...
Greetings Jakke
|
|
|
|
|
Generally, when you run into the limitations of the standard control usage, you have to write custom code. I can imagine two major ways around this.
1) Manage the Height property differently, never letting it pass the maximum size. Handle the zoom settings separately, ignoring the items that are not visible. (Probably the easiest solution.) Pay attention to cases where this could cause problems and write code to prevent them.
2) Create a custom solution in which you draw everything yourself, letting you use any sort of number to handle the height and other values. (Lots of work in most cases.)
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
The API call
StringFormat.SetMeasurableCharacterRanges(CharacterRange[])
will throw an Overflow exception if the CharacterRange[] parameter is greater than 32 elements long. For instance, the following code will throw an exception:
CharacterRange[] ranges = new CharacterRange[33];
StringFormat format = new StringFormat();
format.SetMeasurableCharacterRanges(ranges);
However, if ranges[] was <= 32 elements long, no exceptions are thrown. All of this is regardless of whether each CharacterRange element is initialized (of course, .NET initializes value types anyway). Looking throught the MSDN documentation, I see no mention of a length limit for the .SetMeasurableCharacterRanges method.
So I have 2 questions: is this a known bug or expected functionality? And what other options do I have for retrieving the character positions of text?
The graveyards are filled with indispensible men.
|
|
|
|
|
The documentation I found is a bit confusing. The VB version of the SetMeasurableCharacterRanges method takes one parameter, an array of type CharacterRange. The C# version takes two parameters:
Status SetMeasurableCharacterRanges(
INT rangeCount,
const CharacterRange *ranges
);
The first being the number of elements in the array pointed to by the second parameter, a pointer to an array of type CharacterRange.
The docs I found doesn't say that either parameter is optional, so I'd start there...
RageInTheMachine9532
|
|
|
|
|
Not sure what documentation you're looking at there, but .NET's SetMeasurableCharacterRanges takes only a single parameter, which is not optional.
I posted this question on an MSDN newsgroup and got the following reply:
We hit the same problem, and basically it is an undocumented 'feature'
To get around this limitation, test each character at a time, or in batches
of 32 characters
James
So it seems this is a 'feature'...? Really strange why it would be limited to 32 characters.
The graveyards are filled with indispensible men.
|
|
|
|
|
I wasn't reall impresed with the quality of what I found, but it's in the VS.NET2K3 documentation that came with the Enterprise version. Paste this: ms-help://MS.VSCC.2003/MS.MSDNQTR.2003APR.1033/gdicpp/gdi+/gdi+reference/classes/stringformatclass/stringformatmethods/setmeasurablecharacterranges.htm into the help browser address bar to see what I was looking at. It gives a C# example that takes TWO parameters. It could be that these docs were updated in the Oct'03 update to the VS documentation. I haven't been able to get that update installed...
SetMeasureableCharacterRanges is also not limited to 32 characters, but 32 character ranges.
RageInTheMachine9532
|
|
|
|
|
Hello!
I do not know how to open CD-ROM! Thanks.
|
|
|
|
|
Push the open/close button on the outside of the drive.
- Nick Parker My Blog
|
|
|
|
|
Could you provide some pictures explaining this?
Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski
|
|
|
|
|
|
You get the Reply Of Today gift.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
Mazdak wrote:
You get the Reply Of Today gift.
- Nick Parker My Blog
|
|
|
|
|
That's not correct...
That's how I get to my cup holder!
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
That's how I get to my cup holder!
I always confuse the two!
- Nick Parker My Blog
|
|
|
|
|
This type of functionality isn't built into the .NET framework, so you'll just have to use P/Invoke.
Lucky for you, I guy I know from another forum already has done this[^].
The graveyards are filled with indispensible men.
|
|
|
|
|
heheh
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|
|
|
I'm learning to deliver some additional functionality to the end user I'm going to have to envoke some transact-sql statements to detach and reattach my SQL-Server (MSDE) database. My C# application uses standard ADO.NET but I can't find any examples of Transact-sql statements be called from within a C# program.
Any hints or an snippet of code on how I would do this from within a C# application?
Thanks,
cb
|
|
|
|
|
betterc wrote:
Any hints
Search for SqlCommand class. You can run any query or t-sql statement with it.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
Something like the following should do it:
static void DetachPubsDB()<br />
{<br />
string connStr = "provider=SQLOLEDB;Data Source=(local);User ID=sa;Password=;Initial Catalog=master; Network Library=dbmssocn";<br />
OleDbConnection conn = new OleDbConnection(connStr); <br />
<br />
try<br />
{<br />
conn.Open();<br />
<br />
OleDbCommand cmdDetach = new OleDbCommand("sp_detach_db", conn);<br />
cmdDetach.CommandType = CommandType.StoredProcedure;<br />
cmdDetach.Parameters.Add("dbname", "Pubs");<br />
cmdDetach.ExecuteNonQuery();<br />
<br />
OleDbCommand cmdAttach = new OleDbCommand("sp_attach_db", conn);<br />
cmdAttach.CommandType = CommandType.StoredProcedure;<br />
cmdAttach.Parameters.Add("dbname", "Pubs");<br />
cmdAttach.Parameters.Add("filename1", @"C:\Program Files\Microsoft SQL Server\Data\MSSQL\Data\pubs.mdf");<br />
cmdAttach.Parameters.Add("filename2", @"C:\Program Files\Microsoft SQL Server\Data\MSSQL\Data\pubs_Log.ldf");<br />
cmdAttach.ExecuteNonQuery();<br />
}<br />
catch(Exception excp)<br />
{<br />
Console.WriteLine(excp.Message);<br />
}<br />
finally<br />
{<br />
if(conn.State == ConnectionState.Open)<br />
conn.Close();<br />
conn.Dispose();<br />
}<br />
}
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|