M
M
mihzas2015-09-07 22:10:07
C++ / C#
mihzas, 2015-09-07 22:10:07

How to get mouse coordinates relative to control?

There is a custom control CustomPictureBox inherited from PictureBox. How to make it so that when hovering the cursor you can get the coordinates of the cursor position relative to the CustomPictureBox, and not the coordinates of the mouse position relative to the screen
PS I need this for drawing

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2015-09-07
@GavriKos

Subtract the screen coordinates of the control from the screen coordinates of the mouse, for example.
The second option is to subscribe to the mouse movement event in this control - there will be coordinates relative to the control.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question