青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

GetWindowRect() || GetClientRect()||ScreenToClient()||ClientToScreen

先調用GetWindowRect后再調用ScreenToClient,這個時候得到的rect和直接使用GetClientRect得到的值是相等的。有時候需要獲得窗口矩形的大小和客戶區矩形的大小二者的值,故需要分別調用GetWindowRect和GetClientRect。如果只需要獲得客戶區矩形的大小,調用GetClientRect就行了。GetWindowRect和GetClientRect函數的說明如下:

CWnd::GetClientRect  
    void GetClientRect( LPRECT lpRect ) const;
Parameters:
lpRect
    Points to a RECT structure or a CRect object to receive the client coordinates. The left and top members will be 0. The right and bottom members will contain the width and height of the window.
Remarks:
    Copies the client coordinates of the CWnd client area into the structure pointed to by lpRect. The client coordinates specify the upper-left and lower-right corners of the client area. Since client coordinates are relative to the upper-left corners of the CWnd client area, the coordinates of the upper-left corner are (0,0).

CWnd::GetWindowRect
void GetWindowRect( LPRECT lpRect ) const;
Parameters:
lpRect
Points to a CRect object or a RECT structure that will receive the screen coordinates of the upper-left and lower-right corners.
Remarks:
Copies the dimensions of the bounding rectangle of the CWnd object to the structure pointed to by lpRect. The dimensions are given in screen coordinates relative to the upper-left corner of the display screen. The dimensions of the caption, border, and scroll bars, if present, are included.



GetWindowRect() 得到的是在屏幕坐標系下的RECT;(即以屏幕左上角為原點
GetClientRect() 得到的是在客戶區坐標系下的RECT; (即以所在窗口左上角為原點

GetWindowRect()取的是整個窗口的矩形;
GetClientRect()取的僅是客戶區的矩形,也就是說不包括標題欄,外框等;

第一個函數獲得的是窗口在屏幕上的位置,得到的結果可能是這樣CRect(10,10,240,240);
第二個函數和它不同,它只獲得了客戶區的大小,因此得到的結果總是這樣CRect(0,0,width,height);

ScreenToClient() 就是把屏幕坐標系下的RECT坐標轉換為客戶區坐標系下的RECT坐標。

 

The GetClientRect function retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).

GetClientRect得到的是客戶區的大小,也就是說這樣得到的左上角永遠是(0,0)

The GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.

GetWindowRect 是窗口相對于整個屏幕的坐標,屏幕左上點為0,0

相互轉化用ScreenToClient 或者 ClientToScreen

ClientToScreen
The ClientToScreen function converts the client coordinates of a specified point to screen coordinates.
BOOL ClientToScreen(
   HWND hWnd,        // window handle for source coordinates
   LPPOINT lpPoint   // pointer to structure containing screen coordinates
);

Parameters
hWnd
Handle to the window whose client area is used for the conversion.
lpPoint
Pointer to a POINT structure that contains the client coordinates to be converted. The new screen coordinates are copied into this structure if the function succeeds.
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.


雖然存在調用GetWindowRect后再調用ScreenToClient==GetClientRect,但ScreenToClient()和ClientToScreen()兩者都是屬于WINDOWS API函數,可能是存在一定的冗余設計,但意義不同。
不過在.Net Framework下對WINDOWS API函數進行了重新整理和優化,在獲取控件或窗口的屏幕坐標和客戶區坐標時更方便的多,只需要得到與控件或窗口相對應屏幕坐標和客戶區坐標屬性值就可以了

ScreenToClient
The ScreenToClient function converts the screen coordinates of a specified point on the screen to client coordinates.
BOOL ScreenToClient(
   HWND hWnd,         // window handle for source coordinates
   LPPOINT lpPoint    // address of structure containing coordinates
);
Parameters:
hWnd
Handle to the window whose client area will be used for the conversion.
lpPoint
Pointer to a POINT structure that contains the screen coordinates to be converted.
Return Values:
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.

posted on 2011-04-01 11:30 wrh 閱讀(982) 評論(1)  編輯 收藏 引用

評論

# re: GetWindowRect() || GetClientRect()||ScreenToClient()||ClientToScreen 2011-04-26 12:46 寧波停車棚

這些東西好像我都沒怎么接觸過,呵呵不懂。  回復  更多評論   


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


導航

<2010年10月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

統計

常用鏈接

留言簿(19)

隨筆檔案

文章檔案

收藏夾

搜索

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲无毛电影| 久久精品123| 国产精品二区在线| 欧美夜福利tv在线| 欧美一区91| 亚洲国产高清视频| 亚洲三级免费| 在线观看视频一区二区欧美日韩| 亚洲欧美久久| 久久精品欧美日韩精品| 1000部国产精品成人观看| 免费在线视频一区| 欧美日韩亚洲一区二区三区| 亚洲一区二区三区国产| 香蕉久久a毛片| 亚洲高清在线| 亚洲乱码国产乱码精品精98午夜| 国产精品福利在线观看| 欧美亚洲一区在线| 免费永久网站黄欧美| 亚洲一级免费视频| 亚洲日韩中文字幕在线播放| 亚洲电影一级黄| 国产精品激情偷乱一区二区∴| 久久精品99国产精品| 欧美成人69av| 久久精品在线视频| 欧美激情一区二区三区不卡| 午夜精品久久久久久| 男同欧美伦乱| 欧美在线视频观看| 欧美激情中文字幕一区二区| 亚洲欧美日韩天堂| 欧美国产日韩在线观看| 久久不射2019中文字幕| 老鸭窝亚洲一区二区三区| 亚洲欧美激情视频| 欧美大片在线影院| 久久精品国产成人| 欧美午夜宅男影院在线观看| 欧美jizz19性欧美| 国产视频一区欧美| 一区二区三欧美| 亚洲国产影院| 久久国产综合精品| 欧美一区二区三区啪啪| 欧美精品一区二区三区高清aⅴ| 久久成人综合网| 国产精品高精视频免费| 亚洲精品免费网站| 亚洲欧洲日本国产| 久久视频一区二区| 老司机久久99久久精品播放免费 | 亚洲国产精品热久久| 国产视频一区免费看| 亚洲一本视频| 亚洲天堂激情| 欧美日韩国产首页在线观看| 欧美高清视频一区| 在线不卡中文字幕播放| 欧美影院一区| 久久这里有精品视频| 国产一区日韩二区欧美三区| 亚洲一区国产精品| 小处雏高清一区二区三区| 国产精品福利在线| 亚洲伊人久久综合| 久久爱另类一区二区小说| 国产精品毛片在线看| 亚洲视频在线观看网站| 亚洲一区二区三| 国产精品毛片| 欧美在线一区二区三区| 欧美在线播放| 激情五月***国产精品| 久久久国产一区二区三区| 久久色在线观看| 在线观看精品一区| 欧美国产极速在线| 一区二区日韩精品| 久久国产夜色精品鲁鲁99| 国产一区二区三区在线观看视频| 久久精品日产第一区二区三区| 久久青草久久| 日韩一级大片| 国产精品亚洲视频| 久久久精品日韩欧美| 欧美第一黄色网| 99精品视频一区| 国产精品日韩精品欧美精品| 欧美在线观看视频一区二区| 欧美国产视频在线| 亚洲夜晚福利在线观看| 国产亚洲欧美另类中文| 欧美69视频| 亚洲视频在线观看网站| 免费观看国产成人| 一区二区三区高清在线 | 欧美激情第六页| 99国内精品久久| 久久亚洲欧美国产精品乐播| 亚洲精品一区二区三区av| 欧美性猛交99久久久久99按摩| 久久精品国产欧美亚洲人人爽| 亚洲国产婷婷| 久久久久久穴| 一本色道久久综合一区 | 欧美久色视频| 性欧美大战久久久久久久免费观看 | 激情综合久久| 欧美三级日本三级少妇99| 午夜伦欧美伦电影理论片| 欧美福利视频在线| 久久激情网站| 亚洲一区二区在线免费观看| 亚洲高清在线观看一区| 国产精品久久二区二区| 玖玖玖国产精品| 欧美一二三区精品| 一区二区三区视频在线播放| 欧美国产日产韩国视频| 久久久久免费视频| 亚洲在线国产日韩欧美| 亚洲人久久久| 在线播放一区| 国内成人自拍视频| 国产精品区一区二区三| 欧美日韩另类综合| 欧美国产综合| 欧美成人黄色小视频| 欧美在线三级| 亚洲欧美www| 国产精品99久久99久久久二8 | 亚洲综合电影一区二区三区| 亚洲精品一区二区三| 欧美成人免费播放| 久久夜色精品国产| 久久久久久91香蕉国产| 久久成人av少妇免费| 亚洲欧美日韩中文播放| 亚洲在线视频网站| 一区二区三区久久精品| 一本到高清视频免费精品| 亚洲美女在线国产| 91久久精品国产91性色tv| 亚洲国产精品一区制服丝袜| 狠狠综合久久av一区二区老牛| 国产亚洲欧美中文| 狠狠干狠狠久久| 曰本成人黄色| 亚洲国产精品ⅴa在线观看| 伊人久久亚洲美女图片| 亚洲国产精品va在线看黑人动漫| 在线看欧美日韩| 亚洲欧洲精品一区| 夜夜嗨av一区二区三区中文字幕| 亚洲人妖在线| 亚洲永久在线| 久久国产精品99久久久久久老狼| 久久av一区二区三区漫画| 久久青青草综合| 欧美国产先锋| 99精品热视频只有精品10| 亚洲小视频在线观看| 久久精品国产91精品亚洲| 玖玖在线精品| 国产精品a久久久久久| 国产视频不卡| 亚洲人www| 亚洲在线中文字幕| 久久免费少妇高潮久久精品99| 欧美高清在线播放| 一区二区三区国产精品| 久久国产精品久久久久久电车 | aa成人免费视频| 亚洲欧美在线aaa| 老巨人导航500精品| 欧美日韩在线不卡| 国内精品久久久久影院色| 亚洲精品久久久久久下一站| 香港久久久电影| 欧美激情亚洲另类| 亚洲一区二区三区四区中文 | 欧美成人一区在线| 国产精品亚发布| 最新亚洲激情| 欧美亚洲一级| 亚洲精品国产欧美| 久久精品免费| 国产精品男gay被猛男狂揉视频| 在线日韩中文字幕| 亚洲欧美日韩精品久久久久 | 亚洲男女自偷自拍| 欧美国产高清| 欧美亚洲专区| 国产精品日韩欧美一区二区| 亚洲日韩视频| 欧美丰满高潮xxxx喷水动漫| 亚洲欧美美女| 国产精品乱码妇女bbbb|