Capture OnLButtonDown on picture control.
-
Dear All; I have a dialog box hosting a picture control which has a bitmap loaded in it. The bitmap is scrollable (I derived a class from CScrollView to do that). How do I capture the OnLButtonDown and OnLButtonUp mouse events that happen within the scrollable image (ie. those which happen within the picture control only) ? Thank you
llp00na
-
Dear All; I have a dialog box hosting a picture control which has a bitmap loaded in it. The bitmap is scrollable (I derived a class from CScrollView to do that). How do I capture the OnLButtonDown and OnLButtonUp mouse events that happen within the scrollable image (ie. those which happen within the picture control only) ? Thank you
llp00na
Derive a class from CStatic and make a control variable for the picture object of tis class. Now you can handle the OnLButtonDown and OnLButtonUp inside this class. Another way is to overide the PreTranslateMessage() of the main dialog. Inside it check the message is WM_LBUTTONDOWN or WM_LBUTTONUP and the hWnd is the handle of the picture control.
nave
-
Derive a class from CStatic and make a control variable for the picture object of tis class. Now you can handle the OnLButtonDown and OnLButtonUp inside this class. Another way is to overide the PreTranslateMessage() of the main dialog. Inside it check the message is WM_LBUTTONDOWN or WM_LBUTTONUP and the hWnd is the handle of the picture control.
nave
Thank you for your answer. I will try our your first suggestion, it sounds feasible. Another inquiry if you dont mind, the picture control is scrollable (ie. if the loaded image is bigger than the size of the picture control, scroll bars are provided to allow the user to view all parts of the image) and i will need to retrieve the (x,y) of user clicks within the image. do you think i will have problems getting the coordinates in this case considering the top left corner of the image control as the reference point?
llp00na
-
Thank you for your answer. I will try our your first suggestion, it sounds feasible. Another inquiry if you dont mind, the picture control is scrollable (ie. if the loaded image is bigger than the size of the picture control, scroll bars are provided to allow the user to view all parts of the image) and i will need to retrieve the (x,y) of user clicks within the image. do you think i will have problems getting the coordinates in this case considering the top left corner of the image control as the reference point?
llp00na
-
llp00na wrote:
do you think i will have problems
offcourse no. The point you recieve in the WM_LBUTTONDOWN will be a point relative to the top left postion of the image control itself
nave
-
llp00na wrote:
do you think i will have problems
offcourse no. The point you recieve in the WM_LBUTTONDOWN will be a point relative to the top left postion of the image control itself
nave