0
点赞
收藏
分享

微信扫一扫

mfc中获取当前窗口大小的方法

江南北 2022-06-14 阅读 45
{
CRect rect;
GetWindowRect(&rect);
MoveWindow(0, 0, rect.Width(), rect.Height());
}
CRect   rect;    
GetWindowRect(&rect);//得到所处窗口的绝对坐标;
GetClientRect(&rect);
其中rect.right为x坐标的最大值,rect.bottom为y坐标的最大值
(0,0)为窗口左上角的点坐标。
在当前窗体中显示鼠标当前坐标的方法:
代码如下:
CString str;
str.Format("x=%d,y=%d",point.x,point.y); ((CMainFrame*)GetParent())->m_wndStatusBar.SetWindowText(str);


举报

相关推荐

0 条评论