In this chapter, we examined some of the more advanced problems associated with processing mouse events. We looked at using mouse cursors to give a greater level of feedback to the end user. You can use the stock cursors, or you can create custom cursors.
You saw that hit testing is made easy by functionality in the Rectangle structure, and the Region and GraphicsPath classes.
You also saw the difference between drawing during a Paint event and drawing during a mouse event. You can get a Graphics object for the form during the mouse event and draw without waiting for a Paint event.
The chapter next covered how to draw directly to the display using an alpha technique, creating a semitransparent image of the object being dragged. We also examined the preventative measures to take so that you don’t have the situation where your control thinks that the mouse button is down when it is not.
Finally, you saw how to code an application that allows the user to select parts of the display area by holding the mouse just outside the client area in a manner similar to how selection works in many text editors.
KeywordsCustom Control Mouse Button Graphic Object Event Handler Mouse Cursor
Unable to display preview. Download preview PDF.