VC 獲取滑鼠點座標

2021-04-25 22:33:20 字數 939 閱讀 8027

onlbuttondown 傳入的point座標為客戶區座標,而輸出矩形為窗體座標,

point縱座標需要加上(標題欄高度:26 和對話方塊高度:3)

point橫座標需要加上(對話方塊寬度:3)

int captionheight=getsystemmetrics(sm_cycaption);//標題欄高度

int dlgwidth=getsystemmetrics(sm_cxdlgframe );//sm_cxfixedframe相同

int dlgheight=getsystemmetrics(sm_cydlgframe ); //sm_cxfixedframe相同

int x =point.x + (dlgwidth);    //point橫座標

int y = point.y + (captionheight + dlgheight ); //point縱座標

備註:**************************************
intgetsystemmetrics(intnindex

);

thegetsystemmetricsfunction retrieves various system metrics (widths and heights of display elements)
and system configuration settings. all dimensions retrieved bygetsystemmetricsare in pixels.
int menuheight=getsystemmetrics(sm_cymenu);//選單欄高度

獲取滑鼠點選事件

設定觸控模式 node settouchmode cc.touch mode one by one 單點觸控 或者 node settouchmode cc.touch mode all at once 多點觸控 是否啟用觸控 預設值 false node settouchenabled true ...

獲取滑鼠座標GetCursorPos

下面這個例子是獲取螢幕的座標 include includelresult callback windowproc hwnd hwnd,handle to window uint umsg,message identifier wparam wparam,first message paramete...

c 獲取滑鼠座標

很多時候我們需要用到滑鼠在相對於窗體上的座標,或者相對於螢幕的座標,這裡就把我的經驗記錄下。用control.mouseposition獲得當前滑鼠的座標currentpoint,使用control.pointtoclient方法,前面獲得的currentpoint作為其引數,返回的point型別的...