01BIM社区

 找回密码
 立即注册

扫一扫,访问微社区

查看: 1619|回复: 0

如何获取窗口大小

[复制链接]

156

主题

647

帖子

2540

积分

金牌会员

Rank: 6Rank: 6

积分
2540
发表于 2015-11-1 11:34:03 | 显示全部楼层 |阅读模式
本帖最后由 tzbm123456 于 2015-11-1 14:34 编辑

GetWindowRect函数。如:
CRect rect;
GetWindowRect(&rect);
rect.Width();//宽度
rect.Height();//高度




例:
void CMy01BIM_ApplicationView::OnDraw(CDC* /*pDC*/)
{
        CMy01BIM_ApplicationDoc* pDoc = GetDocument();
        ASSERT_VALID(pDoc);
        if (!pDoc)
                return;

        // TODO:  在此处为本机数据添加绘制代码
        CRect rect;
        GetWindowRect(&rect);
        int width=rect.Width();//宽度
        int height=rect.Height();//高度
        CString str1,str2;
        str1.Format(_T("%d"), width);
        str2.Format(_T("%d"), height);
        AfxMessageBox(str1);
        AfxMessageBox(str2);
}

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|01BIM社区 - 最专业的BIM技术交流平台 ( 渝ICP备15000873号 )

GMT+8, 2024-5-19 18:14 , Processed in 0.356211 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表