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

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

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

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() 得到的是在客戶區(qū)坐標系下的RECT; (即以所在窗口左上角為原點

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

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

ScreenToClient() 就是把屏幕坐標系下的RECT坐標轉換為客戶區(qū)坐標系下的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得到的是客戶區(qū)的大小,也就是說這樣得到的左上角永遠是(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函數(shù),可能是存在一定的冗余設計,但意義不同。
不過在.Net Framework下對WINDOWS API函數(shù)進行了重新整理和優(yōu)化,在獲取控件或窗口的屏幕坐標和客戶區(qū)坐標時更方便的多,只需要得到與控件或窗口相對應屏幕坐標和客戶區(qū)坐標屬性值就可以了

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 閱讀(984) 評論(1)  編輯 收藏 引用

評論

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

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


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


導航

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

統(tǒng)計

常用鏈接

留言簿(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>
            亚洲人成人一区二区三区| 亚洲国产精品www| 亚洲视频图片小说| 欧美日韩国产精品一区| 日韩视频专区| 亚洲一区二区精品在线| 国产乱码精品一区二区三区五月婷 | 可以免费看不卡的av网站| 好男人免费精品视频| 米奇777在线欧美播放| 嫩草国产精品入口| 亚洲一区二区三区视频播放| 亚洲伊人第一页| 精品999在线观看| 亚洲经典自拍| 国产老女人精品毛片久久| 久久亚洲私人国产精品va媚药| 久久亚洲综合色一区二区三区| 亚洲日本一区二区| 中文在线资源观看网站视频免费不卡| 国产精品女人网站| 欧美xx69| 国产精品美女久久久浪潮软件| 久久久久久久网| 欧美精品99| 久久久精品日韩欧美| 免费欧美在线视频| 性感少妇一区| 欧美成人精品在线观看| 性欧美精品高清| 玖玖玖国产精品| 欧美一区三区三区高中清蜜桃| 久久婷婷av| 香蕉av福利精品导航| 欧美大尺度在线| 久久精品一区二区国产| 欧美日韩大片| 免费av成人在线| 国产欧美日本一区视频| 亚洲黄一区二区| 娇妻被交换粗又大又硬视频欧美| 亚洲精品乱码久久久久久按摩观| 一色屋精品视频免费看| 亚洲视频一区二区| 亚洲伦理网站| 久久人91精品久久久久久不卡| 先锋a资源在线看亚洲| 欧美激情亚洲国产| 美女爽到呻吟久久久久| 国产视频久久| 在线视频精品| 一区二区三区产品免费精品久久75| 久久久蜜桃一区二区人| 亚洲欧美日韩在线高清直播| 欧美激情一区在线| 亚洲第一偷拍| 亚洲国产成人久久综合| 久久精品国产亚洲一区二区| 午夜精品久久久久久99热软件| 欧美日韩国产欧| 亚洲精品乱码久久久久久按摩观| 亚洲精品国久久99热| 老司机一区二区| 免费观看成人www动漫视频| 国内精品写真在线观看| 午夜视频在线观看一区| 欧美一区二区久久久| 国产精品亚洲综合久久| 亚洲视频999| 午夜亚洲一区| 国产午夜精品一区理论片飘花| 亚洲欧美日韩天堂一区二区| 性欧美激情精品| 国产自产精品| 久久久一区二区| 欧美激情乱人伦| 亚洲美女91| 国产精品草莓在线免费观看| 亚洲视频一区| 欧美在线一级va免费观看| 国产日韩亚洲欧美综合| 久久成人在线| 亚洲国产精品久久久久| 一区二区三区四区在线| 国产精品久久久久天堂| 欧美一区二区三区精品电影| 蜜桃久久av一区| 日韩一级不卡| 国产精品视频精品视频| 久久精品国产99国产精品| 欧美ed2k| 亚洲自拍高清| 国产在线观看精品一区二区三区 | 亚洲美女一区| 午夜精品免费| 亚洲激情综合| 欧美理论电影网| 亚洲专区在线视频| 欧美不卡视频一区发布| 一区二区三区高清| 国产一区二区中文| 欧美黑人在线观看| 亚洲一区二区精品视频| 欧美国产视频一区二区| 亚洲女同性videos| 亚洲国产成人久久综合| 欧美性开放视频| 久久天堂av综合合色| 中文亚洲欧美| 欧美激情亚洲自拍| 欧美在线视频二区| 一级日韩一区在线观看| 狠狠狠色丁香婷婷综合久久五月| 欧美激情一区| 久久久久久久久综合| 夜久久久久久| 亚洲第一成人在线| 久久久久中文| 亚洲一区二区综合| 在线观看亚洲精品视频| 国产精品试看| 欧美日韩精品一区| 久久亚洲美女| 欧美一级久久| 亚洲一区www| 亚洲美女在线看| 欧美电影免费观看大全| 久久精品国产亚洲精品 | 国产视频欧美视频| 欧美三级网址| 欧美福利在线| 老司机精品视频网站| 欧美在线视频免费| 午夜精品剧场| 亚洲女优在线| 亚洲午夜三级在线| 中文国产成人精品| 在线视频欧美一区| 一区二区三区欧美日韩| 亚洲精品视频一区| 亚洲精品日韩久久| 亚洲国产乱码最新视频| 欧美黑人在线观看| 免费日韩成人| 欧美国产免费| 亚洲国产99| 日韩一级黄色大片| 一区二区三区四区五区精品| av成人动漫| 亚洲在线视频免费观看| 亚洲一区免费看| 欧美亚洲在线视频| 久久av红桃一区二区小说| 欧美在线三级| 美日韩精品免费观看视频| 欧美国产日本高清在线| 欧美精品一区在线| 国产精品v欧美精品v日韩| 国产精品久久国产三级国电话系列 | 亚洲国产精品久久91精品| 亚洲国产精品专区久久| 日韩午夜高潮| 亚洲一区二区三区高清 | 欧美va天堂va视频va在线| 欧美成人中文字幕在线| 91久久在线| 夜夜爽99久久国产综合精品女不卡| 一区二区三区四区国产精品| 亚洲欧美日韩人成在线播放| 久久精品国产第一区二区三区最新章节| 久久国产精品高清| 欧美大尺度在线| 国产精品色网| 怡红院精品视频| 一区二区欧美在线| 久久国产色av| 亚洲国产美女| 亚洲欧美国产77777| 久久视频在线免费观看| 欧美日韩理论| 激情综合电影网| 一区二区三区 在线观看视| 久久久久久久久综合| 亚洲精品欧美激情| 欧美中文字幕视频| 欧美日韩xxxxx| 国内综合精品午夜久久资源| 亚洲精品一区在线观看| 久久精品人人| 亚洲精品乱码久久久久久日本蜜臀 | 久久精品99国产精品| 亚洲国产精品久久久久婷婷老年 | 亚洲国产精品久久久久秋霞不卡| 在线视频亚洲一区| 老牛嫩草一区二区三区日本| 国产精品久久久久三级| 亚洲巨乳在线| 免费在线观看日韩欧美| 性欧美精品高清| 欧美三区不卡|