MFC获取某控件的宽高

获取控件宽高

        CRect rc;
		CWnd *pWnd = GetDlgItem(IDC_STATIC_WARN);//IDC_picture为picture控件ID
		pWnd->GetClientRect(&rc);//rc为控件的大小。
		int tmpx = rc.Height();//控件高
		int tmpy = rc.Width();//控件宽

在某控件上画图

GetDlgItem(IDC_STATIC_WARN)->GetDC()->Ellipse(10, 10,100, 100);

猜你喜欢

转载自blog.csdn.net/qq_44391957/article/details/118213622