DreamDaily

.Net

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Converting Between Screen and Client Coordinates

Because some mouse location information is in client coordinates and some is in screen coordinates, you may need to convert a point from one coordinate system to the other. You can do this easily by using the PointToClient and PointToScreen methods available on the Control class.

Standard Click Event Behavior

If you want to handle mouse click events in the proper order, you need to know the order in which click events are raised in Windows Forms controls. All Windows Forms controls raise click events in the same order when a mouse button is pressed and released (regardless of which mouse button), except where noted in the following list for individual controls. The following list shows the order of events raised for a single mouse-button click:

  1. MouseDown event.

  2. Click event.

  3. MouseClick event.

  4. MouseUp event.

Following is the order of events raised for a double mouse-button click:

  1. MouseDown event.

  2. Click event.

  3. MouseClick event.

  4. MouseUp event.

  5. MouseDown event.

  6. DoubleClick event. (This can vary, depending on whether the control in question has the StandardDoubleClick style bit set to true. For more information about how to set a ControlStyles bit, see the SetStyle method.)

  7. MouseDoubleClick event.

  8. MouseUp event.

posted on 2007-06-09 20:44  Qiwei  阅读(183)  评论(0)    收藏  举报