|
A property of type List<myUserControlItem> may suite your needs.
There's nothing left in my right brain and nothing right in my left brain. |
|
|
|
|
|
use a list instead of an array:
List<myUserControlItem> abc = new List<myUserControlItem>();
myUserControlItem usritem = new myUserControlItem();
abc.Add(usritem);
|
|
|
|
|
Zaegra wrote: Custom item list
you call it a list, yet you don't use a List<>?
|
|
|
|
|
Motivation is the key to software development.
|
|
|
|
|
I draw circle and line to windows form using with GDI.
Sample code;
Graphics graph = this.CreateGraphics();
graph.DrawArc(Pen.Red, new Rectangle(pFisrtPoint, new Size(pSecondPoint.X - pFirstPoint.X, pSecondPoint.Y - pFirstPoint.Y)), 0, 360);
Graphics graph = this.CreateGraphics();
graph.DrawLine(Pen.Red, pFirstPoint, pSecondPoint);
How can I delete shape when just mouse hover this shape painted area area?
Best Regards...
|
|
|
|
|
Hi,
This[^] explains how you should go about it.
|
|
|
|
|
This article is not related about my problem. Do you have any idea? Thanks...
|
|
|
|
|
yes it is, each time your drawing has to change, change the data and call Invalidate().
|
|
|
|
|
how can i use unsafe code?
|
|
|
|
|
You can create a unsafe code block using unsafe keyword and place all of your unsafe code inside it.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
i have code that use unsafe code but when i debug it an error "unsafe code may only appear if compiling with /unsafe"
what can i do?
|
|
|
|
|
Go to project properties. There, under Build tab, check allow unsafe code checkbox.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
thanks alot
|
|
|
|
|
after serching in msdn and internt i couldn't find any predefined section in application config file
to save the types formats (( shor or long for dates etc..))
is there such an element or cofiguration section to save this information
or do i have to create a custom configuration section for it
thanks
|
|
|
|
|
You can add a key under appsettings for the date format and then access it in the code using ConfigurationSettings.AppSettings["dateFormatKey"].ToString() .
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi I have the following code that is updating an dropdown box with information Active Directory information - this below will show Domain Controllers btw.
But I am trying unsuccessfully to cancel an existing running thread if one exist already. this is mainly because sometimes a thread can be running indefinitely and need to abort that, or if another thread is called that need to update the same dropdownbox. Anyway are there any out here who could explain how I could abort an running thread?
private void ThreadDC()
{
Thread TRDomainC = new Thread(ThreadingDC);
if (TRDomainC.IsAlive)
{
TRDomainC.Abort();
}
TRDomainC.SetApartmentState(ApartmentState.STA);
TRDomainC.Start();
}
private void ThreadingDC()
{
comboBox1.Items.Clear();
try
{
if (comboBoxDomains.SelectedIndex >= 0 && comboBoxDomains.SelectedIndex != -1)
{
foreach (string dc in domainInfoComponent[comboBoxDomains.SelectedItem.ToString()])
{
comboBox1.Items.Add(dc);
}
lastIndex = comboBoxDomains.SelectedIndex;
comboBox1.SelectedIndex = 0;
}
}
catch
{
lastIndex = 0;
comboBox1.SelectedIndex = -1;
}
}
|
|
|
|
|
Don't use Thread.Abort - it's evil!
If you want to end a thread, do it cooperatively - make the thread return from it's main method and it will be cleared up properly.
Also, you cannot touch UI controls from any thread other than your main UI thread. Control.Invoke is helpful here.
Here is a good introduction to threading: http://www.albahari.com/threading/[^]
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Not really an option waiting. So need to kill the thread one way or another.
I know about Control.Invoke, but well, dosn't really help me on ending the thread before it is completed.
Ronni
|
|
|
|
|
As Nick said; this[^] may help also.
|
|
|
|
|
Nope, not really. Well I could move to backgroundworker... But there should(right?) be a way to abort the thread without getting into the deep end.
|
|
|
|
|
As Nick and Albahari say, you should not even want to abort a thread, aborting it will leave a lot of objects in an unknown state, putting the app at the risk of a deadlock; how about things that may be locked and never will be unlocked again?
You really need the cooperative approach for thread control.
And a healthy way to access GUI Controls, hence the reference to my article.
|
|
|
|
|
I wrote small application - and i want to add some new feature that in case the user double click on the picture then the default edit application ( for example paint.exe application ) will be open the current picture.
My question are:
1. how can i know what is the default edit picture application that appear on current machine ( how can i know it in run-time ? )
2. how to open the picture in this application in run-time ?
Thanks.
|
|
|
|
|
Hi,
if you execute Process.Start(filename) you get the same result as when the file got double-clicked in Windows Explorer, so any document would get opened by its default application based on file extension associations (e.g. "demo.txt" would be opened by Notepad). So your app doesn't have to know a thing about default apps.
|
|
|
|
|
Hi there
Using Visual Studio 2008 Standard.
Was wondering if anybody could recommend an add-on to do UML diagrams as well as one for unit testing? Preferably freeware.
|
|
|
|
|
VS 2010 have both included
I use MS Visio for UML diagrams and Resharper for unit testing
|
|
|
|