get_mpositionT_get_mpositionGetMpositionGetMpositionget_mposition (算子)

名称

get_mpositionT_get_mpositionGetMpositionGetMpositionget_mposition — 查询鼠标位置。

签名

get_mposition( : : WindowHandle : Row, Column, Button)

Herror T_get_mposition(const Htuple WindowHandle, Htuple* Row, Htuple* Column, Htuple* Button)

void GetMposition(const HTuple& WindowHandle, HTuple* Row, HTuple* Column, HTuple* Button)

void HWindow::GetMposition(Hlong* Row, Hlong* Column, Hlong* Button) const

static void HOperatorSet.GetMposition(HTuple windowHandle, out HTuple row, out HTuple column, out HTuple button)

void HWindow.GetMposition(out int row, out int column, out int button)

def get_mposition(window_handle: HHandle) -> Tuple[int, int, int]

描述

get_mpositionget_mpositionGetMpositionGetMpositionGetMpositionget_mposition returns the pixel accurate image coordinates of the mouse pointer in the output window and the mouse button pressed. These values are returned regardless of the state of the mouse buttons (pressed or not pressed). If at least one mouse button is pressed, the state of the modifier keys is returned as well. If no mouse button is pressed, get_mpositionget_mpositionGetMpositionGetMpositionGetMpositionget_mposition returns 0 in ButtonButtonButtonButtonbuttonbutton, even if a modifier key is pressed. The following values are assigned to the individual buttons and keys:

0:

No button,

1:

Left button,

2:

Middle button,

4:

Right button,

8:

Shift key,

16:

Ctrl key,

32:

Alt key.

The sum of the values for all pressed buttons/keys is returned in ButtonButtonButtonButtonbuttonbutton

The origin of the coordinate system is located in the left upper corner of the window. For graphics windows the coordinates RowRowRowRowrowrow and ColumnColumnColumnColumncolumncolumn are expressed with consideration of the current image part (see set_partset_partSetPartSetPartSetPartset_part).

If subpixel accurate image coordinates are required, you can use the operator get_mposition_sub_pixget_mposition_sub_pixGetMpositionSubPixGetMpositionSubPixGetMpositionSubPixget_mposition_sub_pix

注意

get_mpositionget_mpositionGetMpositionGetMpositionGetMpositionget_mposition fails (returns 5 ( H_MSG_FAIL) ) if the mouse pointer is not located within the window. In this case, no values are returned.

执行信息

参数

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (输入控制)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

窗口句柄。

RowRowRowRowrowrow (输出控制)  point.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row coordinate of the mouse cursor in the image coordinate system.

ColumnColumnColumnColumncolumncolumn (输出控制)  point.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column coordinate of the mouse cursor in the image coordinate system.

ButtonButtonButtonButtonbuttonbutton (输出控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Mouse button(s) pressed or 0.

结果

get_mpositionget_mpositionGetMpositionGetMpositionGetMpositionget_mposition 返回值 2 ( H_MSG_TRUE )。 If the mouse pointer is not located within the window, 5 ( H_MSG_FAIL) is returned.

可能的前趋

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

替代

get_mbuttonget_mbuttonGetMbuttonGetMbuttonGetMbuttonget_mbutton, get_mposition_sub_pixget_mposition_sub_pixGetMpositionSubPixGetMpositionSubPixGetMpositionSubPixget_mposition_sub_pix, get_mbutton_sub_pixget_mbutton_sub_pixGetMbuttonSubPixGetMbuttonSubPixGetMbuttonSubPixget_mbutton_sub_pix

另见

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

模块

基础