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

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年12月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

統計

常用鏈接

留言簿(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>
            午夜视频久久久久久| 亚洲大胆av| 美女日韩欧美| 欧美国产日韩精品| 亚洲欧美区自拍先锋| 老鸭窝毛片一区二区三区| 99精品热视频| 久久国产精品久久久久久| 99香蕉国产精品偷在线观看| 久久9热精品视频| 亚洲午夜国产成人av电影男同| 久久久91精品| 性伦欧美刺激片在线观看| 欧美日韩岛国| 欧美激情黄色片| 国产亚洲欧美另类中文| 99视频精品| 亚洲国产岛国毛片在线| 亚洲女性喷水在线观看一区| 亚洲蜜桃精久久久久久久| 久久久999精品免费| 91久久国产综合久久91精品网站| 国产主播精品在线| 亚洲欧美综合v| 久久av一区二区三区漫画| 国产精品视频导航| 亚洲视频在线一区| 亚洲一区二区综合| 欧美日韩在线精品| 国产一区欧美| 欧美大胆a视频| 欧美岛国激情| 亚洲国产婷婷综合在线精品 | 欧美大胆成人| 香蕉成人啪国产精品视频综合网| 欧美中文字幕视频| 亚洲每日更新| 亚洲精品日韩一| 欧美国产亚洲另类动漫| 欧美在线啊v| 在线天堂一区av电影| 亚洲欧美日韩网| 日韩午夜在线播放| 亚洲国产精品99久久久久久久久| 国产欧美精品日韩区二区麻豆天美 | 国产精品一区在线观看| 一区二区久久| 欧美一区二区视频在线观看| 国产三级欧美三级| 久久精品亚洲一区二区| 亚洲一区二区三区免费视频| 欧美一区二区成人6969| 一区二区三区四区五区视频| 国产精品欧美一区喷水 | 在线综合亚洲| 亚洲国产一区在线| 在线电影国产精品| 久久亚洲春色中文字幕久久久| 母乳一区在线观看| 亚洲精品中文字幕在线观看| 黄色一区二区三区四区| 欧美久久视频| 午夜精品久久久久久久久久久| 艳妇臀荡乳欲伦亚洲一区| 伊人久久久大香线蕉综合直播 | 久久久精品999| 亚洲激情第一页| 在线免费观看日本一区| 欧美日本国产在线| 欧美久久综合| 欧美人与禽猛交乱配| 欧美电影资源| 欧美美女日韩| 欧美日韩国产综合新一区| 欧美区在线播放| 欧美日韩视频在线一区二区观看视频 | 国产久一道中文一区| 国产精品丝袜久久久久久app| 国产精品看片资源| 久久亚洲电影| 欧美成人精品三级在线观看| 欧美承认网站| 欧美人与禽猛交乱配视频| 欧美日韩网址| 国产精品午夜视频| 国产综合色产在线精品| 在线看欧美视频| 亚洲精品欧美在线| 亚洲色诱最新| 亚洲美女视频| 亚洲一区二三| 久久久久久久久岛国免费| 狂野欧美激情性xxxx欧美| 亚洲免费综合| 久久麻豆一区二区| 亚洲欧美日韩一区在线观看| 午夜精品视频在线观看| 久久久之久亚州精品露出| 欧美国产精品| 一本色道久久88综合亚洲精品ⅰ| 亚洲专区免费| 免费日韩成人| 久久久综合香蕉尹人综合网| 午夜在线观看免费一区| 在线视频你懂得一区二区三区| 亚洲欧美久久久久一区二区三区| 久久精品视频一| 欧美三级韩国三级日本三斤| 欧美黑人一区二区三区| 国产精品人成在线观看免费 | 制服丝袜激情欧洲亚洲| 欧美在线免费观看视频| 欧美精品一区二区三区蜜桃 | 亚洲一区www| 老司机精品福利视频| 国产精品欧美激情| 91久久夜色精品国产九色| 伊人久久大香线| 亚洲一区二区三区高清| 久久人人爽人人爽爽久久| 99视频精品全部免费在线| 久久激情久久| 国产精品成人一区二区三区夜夜夜 | 亚洲国产精品一区二区三区| 亚洲一区二区三区精品视频| 玖玖精品视频| 亚洲一区二区三区高清不卡| 免费欧美日韩国产三级电影| 国产欧美日韩综合一区在线播放| 亚洲精品自在在线观看| 久久久在线视频| 亚洲影院免费| 欧美日韩精品久久久| 亚洲国产欧美在线| 久久亚洲国产成人| 免费视频亚洲| 欧美在线啊v| 国产精品嫩草99a| 一区二区欧美国产| 亚洲国产毛片完整版| 亚洲精品麻豆| 亚洲欧美日本国产有色| 欧美精品在线网站| 亚洲高清久久| 免费人成网站在线观看欧美高清 | 欧美性猛交xxxx乱大交蜜桃| 国产精品久久久久久久久搜平片| 亚洲肉体裸体xxxx137| 另类图片国产| 久久精品视频在线| 国产真实精品久久二三区| 午夜精品美女久久久久av福利| 日韩亚洲视频| 久久成人精品| 国产一区二区按摩在线观看| 欧美一区二区三区四区高清| 亚洲深夜影院| 国产精品国产精品国产专区不蜜| 夜夜嗨av一区二区三区中文字幕 | 好男人免费精品视频| 亚洲剧情一区二区| 欧美国产丝袜视频| 欧美成人免费小视频| 亚洲国产欧美日韩精品| 欧美激情一区二区三区蜜桃视频| 六月婷婷一区| 国产精品一区二区三区乱码| 午夜精品久久久久久久久久久久久| 一本色道久久| 国产精品嫩草影院一区二区| 羞羞漫画18久久大片| 欧美亚洲日本一区| 欧美日韩喷水| 亚洲欧美色婷婷| 亚洲综合丁香| 黄色一区二区三区| 欧美激情亚洲视频| 欧美啪啪成人vr| 亚洲免费在线看| 欧美主播一区二区三区| 一区二区亚洲欧洲国产日韩| 欧美成人午夜激情| 欧美日韩国产另类不卡| 亚洲一区影院| 久久精品一二三| 亚洲人www| 亚洲午夜精品一区二区三区他趣| 国产目拍亚洲精品99久久精品| 久久久久成人精品| 你懂的亚洲视频| 亚洲永久免费观看| 久久激情视频久久| 一区二区三区欧美亚洲| 亚洲一区二区黄色| 在线观看中文字幕亚洲| 亚洲精品一二三| 国产专区欧美精品| 亚洲激情网站| 国产日韩一级二级三级| 欧美激情亚洲激情|