zoukankan      html  css  js  c++  java
  • GetClientRect和GetWindowRect的区别

    GetWindowRect() 得到的是在屏幕坐标系下的RECT(即以屏幕左上角为原点)

    GetClientRect() 得到的是在客户区坐标系下的RECT(即以所在窗口,去掉了标题栏,左右下边框等之后的左上角为原点,仅仅是个大小,返回值的左上角永远为00

    ScreenToClient() 就是把屏幕坐标系下的RECT坐标转换为客户区坐标系下的RECT坐标。 ClientToScreen反之。还有SetParent方法可以设置窗口间的关系,在c#中的调用如下:

    public struct RECT

    {

    public int X1;

    public int Y1;

    public int X2;

    public int Y2;

    }

    [DllImport("User32.dll")]

    static extern IntPtr SetParent(IntPtr hWnd, IntPtr hParent);

    [DllImport("user32.dll")]

    public static extern bool GetClientRect(IntPtr hWnd, ref RECT lpRect);

    [DllImport("user32.dll")]

    public static extern bool GetWindowRect(IntPtr hWnd, ref RECT rect);

  • 相关阅读:
    毕设进度28
    任务27
    任务26
    任务25
    任务24
    第二次冲刺
    课堂作业-搜狗输入法
    课堂作业-寻找水王
    博客花园典型用户和场景
    第十天
  • 原文地址:https://www.cnblogs.com/bear831204/p/1402372.html
Copyright © 2011-2022 走看看