|
You can bind the events in a loop:
foreach (Label label in drgLabel) {
label.MouseOver += new MouseEventHandler(drgLabel_MouseOver);
}
Which Label actually received the vent can be obtained from the sender. You surely have to cast this one:
private void drgLabel_MouseOver(object sender, MouseEventArgs mea) {
Label label = (Label)sender;
}
All events needed for drag and drop can be bound this way.
|
|
|
|
|
I have a program that was running really well on my computer. For sometime now, it has been running really slow and I find it hard to understand. I have scanned for viruses and spyware but couldn't find any and no possible reasons as the why the program is running that slow. Any suggestions? My computer specification is : pentium4, 3.40GH, 512MB
Nana
|
|
|
|
|
1) Is this the correct forum, is it a C# program?
2) Has your disk been defragged recently?
3) Do you have lots of services / background apps running?
Ed
|
|
|
|
|
It is a C# project i am working. I do not have lots of back apps running. This is because I am running below the physical memory. Yes it has been fragmented . Thank you.
Nana
|
|
|
|
|
Well, there could be thousands of reasons...
What kind of program is it? What does it do? Who made it? How slow is "really slow" really?
---
b { font-weight: normal; }
|
|
|
|
|
I am new to C#, and I have compiled a simple exe (a WindowsFormsApp, not a console app) to perform an operation, and want to notify the calling application when it has completed and return a status code.
ApplicationExit();
Just seems to exit, and even if I try to set a return code with:
System.Environment.ExitCode = #;
I don't seem to get anything either.
Can anyone help??
Thanks,
Mark
|
|
|
|
|
Hello,
Try the following
[STAThread]
static void Main()
{
Application.Run(new Login());
return 999;
}
In the retun, you get the exit code
/// -----------------------
Braulio Díez
http://www.bdiez.com
/// -----------------------
|
|
|
|
|
|
Doesn't have to be, valid types are void and int according to the C# spec I seem to remember, same as in ANSI C
Ed
|
|
|
|
|
|
Ravi Bhavnani wrote: Isn't Main() a void method?
Main() can be either void or int :
[STAThread]
static int Main(string[] args)
{
if (error)
return 1;
else
return 0;
}
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
Ravi,
Yes, your code works perfectly. Thanks!
This code works also:
Application.Exit();
Environment.Exit(2445);
Thanks,
Mark
|
|
|
|
|
Thanks, but I think you meant to thank Braulio.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
|
Hi,
When loading a program how do i check if an instance of the same program is already runing, and if so maximizing it from the system tray instead of opening a new instance?
tnx
Roy
|
|
|
|
|
Search the articles here on Code Project. There are many that cover this topic.
www.troschuetz.de
|
|
|
|
|
Hi, I get a window crash on executing the following code. Problem tracked on sending the message RB_SIZETORECT. Please let me know if there is any solution for this and anybody faced same problem. Thanks ..
Win32Wrapper.RECT rbWindowRect = new Win32Wrapper.RECT();
Win32Wrapper.GetWindowRect(m_ReBarWindowHandle, out rbWindowRect);
int height = Win32Wrapper.SendMessage(
m_ReBarWindowHandle, Win32Wrapper.RB_GETROWHEIGHT, 0, 0);
Win32Wrapper.RECT insetRect = new Win32Wrapper.RECT();
insetRect.Left = rbWindowRect.Left;
insetRect.Top = rbWindowRect.Top;
insetRect.Right = rbWindowRect.Right;
insetRect.Bottom = (rbWindowRect.Top + height);
Win32Wrapper.SendMessage(
m_ReBarWindowHandle,
Win32Wrapper.RB_SIZETORECT,
0,
ref insetRect);
test test
|
|
|
|
|
Hello,
When you build a custom control and place it on the toolbar in the VS IDE, then add it to a form, the public properties are dynamically loaded for that control/class in the properties window, right? I want to replicate that functionality in a test application.
Basically I'm building a class library that serializes/deserializes classes into/from XML documents on a network stream (through a socket.) As the serialized objects come down the wire and are deserialized into objects, they are sent to the (Windows) UI through events. I want to store them into something like a ListView (using a derived class from ListViewItem that holds a reference to the object) then when I click on an item in the ListView, a properties window is displayed showing all the public properties of that object along with the values. Then I can make sure that the objects are being serialized/deserialized correctly.
Any ideas how would I do this?
Thanks
|
|
|
|
|
You can achieve this by using reflection. The following lines of code should point you in the right direction.
PropertyInfo[] propertyInfos = obj.GetType().GetProperties();
for (int index = 0; index < propertyInfos.Length; index++)
{
propertyInfos[index].Name;
propertyInfos[index].GetValue(obj);
}
www.troschuetz.de
|
|
|
|
|
That't great! Thank you very much
|
|
|
|
|
You can use a propertygrid to display the properties of the class.
You can make changes to the object through the propertygrid though.
|
|
|
|
|
I have an alarm application for a Pocket PC (DELL Axim x51). When the alarm ring I play a beep sound using soundplayer class's PlayLooping method. But the sound stops on touch of any part of screen. I should play the sound until the user hits the STOP/SNOOZE menu buttons(which I have in my application). I display a messagebox when it starts playing. please suggest me how to keep the sound playing until the user hits my menu buttons. I do stop it in menu's event handler but before that when the user clicks on the screen it stops. I need to prevent this from happening and should make the sound stop only on click of my menu items.
--Shobha
-- modified at 10:56 Monday 3rd April, 2006
I have forgot to mention that I'm using OPENNETCF's Soundplayer class and my project is on Visual Studio.NET 2003.
|
|
|
|
|
Hi
I got an .png Image and want to convert it in an .gif file. When i try to show the .png file in an img tag the backround color of the image is grey. I heard Inetrnet Explorer can't show transparent .png files.
So i want to convert it in an .gif file. But after that the background of my .gif file is black..
<br />
String gifFilePath2 = System.IO.Path.Combine(path, fileName + "_scaled.png");<br />
String gifFilePath3 = System.IO.Path.Combine(path, fileName + "_scaled.gif");<br />
<br />
System.Drawing.Image imgGIF = System.Drawing.Image.FromFile(gifFilePath2);<br />
Bitmap bmpGIF = new Bitmap(imgGIF, size);<br />
bmpGIF.Save(gifFilePath3, System.Drawing.Imaging.ImageFormat.Gif);<br />
|
|
|
|
|
How to get: selected or not selected some text or images on page of axWebBrowser? It is for work with clipboard.
|
|
|
|
|
Can you make your question more structured please....
_____________________
Proud to be Albanian
_____________________
|
|
|
|