设置位置可以使用setWindowPos
但是并没有函数GetWindowPos获取位置
可以通过一下方法获得
相关函数
GetClientRect(); //获得client区域
GetWindowRect(); //获取window区域
ScreenToClient(); //相互转换
ClientToScreen();
由于GetClientRect()获得的区域不包括位置,得到的rect的left,top必然为0
而GetWindowRect();获得的区域包括位置,但会发现获得值不准确,应该是加上了窗体边界。(!!不确定)
正确方法:
CRect rt;
GetWindowRect(&rt); //获得window区域
但是并没有函数GetWindowPos获取位置
可以通过一下方法获得
相关函数
GetClientRect(); //获得client区域
GetWindowRect(); //获取window区域
ScreenToClient(); //相互转换
ClientToScreen();
由于GetClientRect()获得的区域不包括位置,得到的rect的left,top必然为0
而GetWindowRect();获得的区域包括位置,但会发现获得值不准确,应该是加上了窗体边界。(!!不确定)
正确方法:
CRect rt;
GetWindowRect(&rt); //获得window区域