I am having list box on form filled with some items. I want to close the form on the double click on any of List items.
I am able to handle double click event but that is of ListBox control not of the item. So once the item is selected and somewhere else(not on item) user double clicks unintentionally then also it gives me selection.
Is there way i can hanldle the event only for double click on listBox items?
I have a very dirty workaround for you. Some, might say I only provide dirty solutions
Easy solution would be to use the MouseDown event and chack the Clicks property of the MouseEventArgs.
I know that "Clicks>1" is not equal doubleclick, but maybe it fits for you.
Here you can do a check if the Y position of the MouseEventArgs is inside a region.
This region can be validated with the "PreferredHeight" property of the ArrayList class.
Dirty is, that it needs an offset depending on the "BoarderStyle" you are using.
Here an example:
privatevoid yourListBoxes_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
//Not really DoubleClick, but maybe ok for youif(e.Clicks>1)
ListBox ActListBox = sender as ListBox;
if(ActListBox.BorderStyle == BorderStyle.None)
YactHeight= ActListBox.PreferredHeight - 8; //Offset needed
//Is inside Items region//Do stuff here
If you need it more often I would suggest you to inherit your ownb ListBox.
This should override the OnMouseDown method and do the validation there.
If the position is inside the Items region you could fire an custom event there, which you handle in your code.
The other solution could be, to handle the DoubleClick.
As the System.EventArgs do not provide a act position, you would have to use the Cursor position in combination with the controls position PointToScreen.
Is there a way that I can import multiple projects (csproj, vbproj) at one time. As we all know vs2005 has a add project to solution option, but I cannot select multiple projects at once. I have a lot of projects and importing one at a time get tedious very quickly. So if there is any plugin/app/workaround please let me know.
Hello, my name is Joan Miramontes, and im actually developing an application using the upnp stuff,
this is for a project for my BA D,
... so i have been using the upnp intels tools to get familiarized with them, in order to develop an application with c#,
the objective is to develop a control point, the control point need to have the posibility as well as one of the tools of intels of be aware of all the activity of the devices and be capable of control them, also it will be able of .. show the device, like if it was the device, in the other hand also build the devices... in order that the control point can control them, or should i say use them.
Well the thing here so far is thath i already know more or less how to build the device, im using the intel tools(the device builder and author service ) and just add the c# code that i need on every device. my prob here is that i have no idea on how make the control point, how to make the application that discovers the devices, and be able to control them or use the services that each one has... how to make the functions or the classes... or if its some already build it, where to find them or use them...
i forget to mention that all the applications im developing is for windows so im using projects on the .net application with forms and all the graphic stuff.