|
本帖最后由 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);
}
|
|