开发者

Manipulating Custom User Controls Given Only (x,y) Screen Coordinates (without Mouse)

Gi开发者_如何学Goven only an (x,y) point on the screen (without being allowed to use the mouse), how can you manipulate a custom UserControl?

For example, I have a custom slider that I want to manipulate using only an x, y returned by a vision code (the vision code acts like a mouse, but I am not actually supposed to use the mouse).


How does the mouse normally interact with the custom UserControl? Does the UserControl have an EventHandler when the mouse clicks/moves on it? If so, you can call the Control's Mouse_Click event (for example) from elsewhere in the code and pass in the arguments that you want. You can do this with code logic or other controls with the same parent as your UserControl.

Ideally, you can set your UserControl up so that it doesn't interact with the mouse directly. Rather, the Control and Mouse both get/set a shared variable representing the XY of the mouse. This makes things easier to test. What you want to use is Binding.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜