Getting Mouse Events on a ComboBox

梦想的初衷 提交于 2019-12-02 00:22:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!