Positionsangabe nach Mausklick
-
Hi Leute!
Weiß jemand von euch, wie man die X- und Y-Koordinaten nach einem Klick(WM_LBOTTOMDOWN) liest, in zwei Variablen speichert, und dann am Bildschirm ausgibt.
Danke!!!
-
Also, zuerst einmal heißt das Ding WM_LBUTTONDOWN...
Dann solltest Du Dir angewöhnen, die MSDN-Library zu benutzen!
WM-LBUTTONDOWNDort steht:
lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
Use the following code to obtain the horizontal and vertical position:
xPos = GET_X_LPARAM(lParam);
yPos = GET_Y_LPARAM(lParam);You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.
-
So mal als 'starter':
Mit dem ClassWizard 'OnLButtonDown' erstellen:
void CYourView::OnLButtonDown(UINT nFlags, CPoint point) { int x = point.x; int y = point.y; ...Wie willst Du die Koordinaten ausgeben (Textfeld; auf den Hintergrund geschrieben) ?
-Captn.
-
Da ist mir doch schon wer zuvorgekommen
