|
Not exactly. Again, in most cases you want to do more than add a message box. Say for instance that when the process is finished, you want to write something to a textbox on that form. You MUST NOT update the textbox in the new thread. That is a no no in Windows. You must only update controls on the windows main thread (the win proc).
The article I've already mentioned explains all this. Take the time to read it, it's informative and it helped me alot as well.
|
|
|
|
|
Cool. Will look it up.
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
It is strange, anyone say : "it must be true", but .NET "no, rectangle isn't visible" !!!
RectangleF clippingRectangle = new RectangleF(0.0160072f,0f,0.002000898f,0.3201439f);
Region region = new Region(clippingRectangle);
bool success = region.IsVisible(new RectangleF(0,0,150,150)); // return false !!!
Have you idea how can I correct it ?
Please
Wizard_01
|
|
|
|
|
I've found by experiment that the problem is with the width (0.002...). If either the width or the height of the rectangle used to create the region is less than 0.03125 then the problem occurs. I've also found that
region.IsEmpty(myform.CreateGraphics())
returns true if either the width or height is less than this value.
I'm afraid I've no idea why a width/height of less than 0.03125 makes a region empty, or what you can do about it (except check for a size less than this and make it bigger). 0.03125 = 1/32, so maybe this is some "magic number" used within GDI+?
Chris Jobson
|
|
|
|
|
Ohhh
I use this for zoom in/out in my new control. (I was so lazy to recalculate everytime when zoom has changed cell-region and rectangle to new values)
Maybe it necessery but slower
Do you know how can I region flow by 1 pixel ? (I can be enoght in this case for me )
Thank you ...
Wizard_01
|
|
|
|
|
Right. As a feature in my Animation engine, I want to be able to read an XML file for frame information.
In the engine I have an enum for storing specific types of frames.
For example one being for where the bitmap of the frame is stored.
public enum BitmapLocations
{
InExe,
Filesystem
}
Now, I have a dataset for reading an XML file into. I can cast any standard types easily. Such as:
(string)row["name"]
But when it comes to this enum value, I keep getting an invalid cast exception. I've tried:
XML:
<location>InExe</location>
C#:
(BitmapLocation)row["location"]
And this throws the exception.
I've also tried assigning the enum values to a number and using that instead, but still no luck.
Any ideas?
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "But a fresh install - it's like having clean sheets" - C. Maunder Lounge 3 Mar '03
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
BitmapLocations dummy = BitmapLocations.InExe; // dummy assignment, does not matter
String s = "Filesystem";
// convert string to enum
BitmapLocations bl = (BitmapLocations) Enum.Parse(dummy.GetType(), s);
|
|
|
|
|
Hi,
We are soon going to start to distribute .NET components/controls.
If you have something for .NET you think could be sold please contact us at info[at]compona.com for more info.
//Roger
|
|
|
|
|
Hey .
As I understood , this property , if set explicitly , should
disable the autmatically expantion of the array when using "Add" ,when the Count equals to Capacity ..
well .. this doesn't work for me .
I just don't want the ArrayList to be expanded automatically when adding item , when Count equals to Capacity.
instead I'd expect that it will raise some exception .
of course I can do all that in my own class that using the ArrayList , but
I'd like that to be done in ArrayList itself .
anyone knows how to do it ?
Alex
ICQ : 10676475
email : alexyag@inter.net.il
===================================================
"The harder you fall, the higher you bounce." - American Proverb
|
|
|
|
|
I'm pretty sure Capacity just pre-assigns the memory, so if you have 5 items and a capacity of 10 then it's holding on to the memory for the other 5. But then when you put the 11th item in, your Capacity is increased to 11.
What do you actually want to do when item 11 is added?
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
Paul Riley wrote:
I'm pretty sure Capacity just pre-assigns the memory
Yes.
public virtual void System.Collections.ArrayList.set_Capacity(int value) {
object[] local0;
if (value != (int) this._items.Length) {
if (value < this._size)
throw new ArgumentOutOfRangeException(...);
if (value > 0) {
local0 = new Object[checked((uint) value)];
if (this._size > 0)
Array.Copy(this._items, 0, local0, 0, this._size);
this._items = local0;
return;
}
this._items = new Object[16];
}
}
|
|
|
|
|
You can fix the size of the ArrayList like so ...
// Creates and initializes a new ArrayList.
ArrayList myAL = new ArrayList();
myAL.Add( "The" );
myAL.Add( "quick" );
myAL.Add( "brown" );
myAL.Add( "fox" );
myAL.Add( "jumped" );
myAL.Add( "over" );
myAL.Add( "the" );
myAL.Add( "lazy" );
myAL.Add( "dog" );
// Create a fixed-size wrapper around the ArrayList.
ArrayList myFixedSizeAL = ArrayList.FixedSize( myAL );
An exception will be thrown whenever yuo add or remove an item from
the array. However, you can modify the items currently in myFixedSizeAL.
|
|
|
|
|
In SQL Server is it possible to have a trigger that will throw an event which could be caught by C# program running in the back ground?
Is this even possible? If it is, have u any links to help/examples?
a better description of the problem...
What I want to happen is that when we import data in to our database
(INSERT) that a trigger is called.
The trigger passes that data into a validation tool that cleans that
data and writes it back to a new clean database.
There needs to be two tables, one containing the raw original data and
one containing the cleaned up data.
The reason this is not done using a program to load the data is to
ensure any data loaded in to the database is cleaned.
Tommy
|
|
|
|
|
Hello,
does anybody know a way to find out if the following array
contains a certain element without iterating through it?
int[] arr = {1,3,5,7...};
Thanx in advance...
Brian
|
|
|
|
|
Array.IndexOf
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
|
Dear all:
I would like to register personal protocol the same as http.
what I want is the look and feel the same as http, you know, the richtextbox support such protocol, while you typing http://w3c.org, then a link wa shown.
I do not want to use ole to solve this.
|
|
|
|
|
Lookup CodeProject for an auto-fill combo[^] article.
|
|
|
|
|
|
I need to be able to see the status a printer ie. Paper Jammed, On-Line, Off-Line etc. but have got no idea were to start looking?
|
|
|
|
|
I have been playing around with .NET remoting for a while (roughly two weeks), and today is the first time I noticed that the code in my remoted object is always being run on the client. I have made a benchmark test for this. When I run the test on my main machine (P4XP), I get in the 100's for the result. I start up a server session on a remote machine (ATHLON), and then I run, from P4XP, the same test, but supposedly on ATHLON. The big surprise is that I still get nearly the same benchmark result and I can see my CPU working 100%, on the local machine. When I run the other way around (from ATHLON to P4XP), I get the result for ATHLON, so I always get the result for the local machine. So my question is, is this normal behavior for .NET remoting? Can I do anything to offset the work to the remote machine? Your help is greatly appreciated.
--Dacris
|
|
|
|
|
Well, I've solved this problem. The remoting object was passed by-reference, but the remoting object was a collection of benchmark tests. The tests themselves were marked serializable, so they were run locally. Changing the tests to derive from MarshalByRefObject solved the problem.
--Dacris
|
|
|
|
|
i want to get username and password in active directory,but i don't konw how can i.
|
|
|
|
|
can I read a binary registry key in C# - or do I have to revert to C++?
Specifically, I'm trying to enumerate TIMEZONE information from the registry
(HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones), which turned from a little side hack into a complete research project
specifically the tzi value, which contains a binary Win32 TIME_ZONE_INFORMATION gives me headaches - esp. since it contans arrays.
Any idea how I can read it?
Italian is a beautiful language. amare means to love, and amara bitter.
sighist | Agile Programming | doxygen
|
|
|
|
|
To read from the registry you use the System.Win32.Registry class. The System.Win32.Registry class has a method for each "hive". Use one of the methods to return its key as a RegistryKey object. You get/set values as objects, using the GetValue and SetValue methods of the RegistryKey object.
|
|
|
|