问题
I am working on WINCE platform, developing windows form app in C#, I need to implement a mouse click event for DROP DOWN BOX, but compact framework doesn't have a support for mouse click events.
Can anyone suggest me any alternative way to implement the MOUSE CLICK EVENT for combobox (DROP DOWN BOX).?
PS: I am using GOT FOCUS EVENT on drop down box but it's not flexible, I need to run the code when the DROP DOWN BOX is clicked or when it is DROPPED DOWN.
Any suggestions or code snippets will Help me a lot. Thanks !!
回答1:
I will happy if this could help u,otherwise please do not vote down :D ;)
u can use this event on your form:
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
int maxX = 1000;
int minX = 5;
int maxY = 1000;
int minY = 5;
if ((MousePosition.X < maxX) && (MousePosition.X > minX)
&& (MousePosition.Y > minY) && (MousePosition.Y < maxY))
{
//do something
}
}
As u can see I have limited the position of mouse. this must work ;)
来源:https://stackoverflow.com/questions/23125727/getting-mouse-events-on-a-combobox