Treatment of mouse WinAPI

The question was asked: 6 years 10 months ago   views: 11
0

Actually, I have such a task: draw in the window, some shapes, and get them to flash a colour when you press them. How to treat depression on a specific figure?

Asked: TheThing TheThing 10-04-2012 в 00:58:43
Track mouse coordinates, when you click see anywhere, pererisovyvali the scene in new colors. - Yura Ivanov Yura Ivanov 10-04-2012 в 01:59:41

Answers   2

0

Need to handle a mouse click in the window, WM_LBUTTONDOWN for example, to look for the coordinates of the figure, which hit and redraw it in a different color. Do not forget to draw back the right color.

Answered: ganouver ganouver 10-04-2012 в 09:40:59
0

If you use WinAPI, it is possible to provide figures in the form of regions (CreateRectRgn, CreateEllipticRgn, CreatePolygonRgn). Function PtInRegion checks whether the point in the region, and how to find the coordinates of the desired point, you wrote above: processing message WM_LBUTTONDOWN.

Answered: alex-rudenkiy alex-rudenkiy 10-04-2012 в 14:08:28