在对话框上加了一个控件,想用它来定位,在它内部再切分成若干个小矩形,用来模拟窗口的切割分屏:


暂时放到搜索按钮的响应函数中吧:
void CDlgControl::OnButtonSearch()
{
// TODO: Add your control notification handler code here
CRect rectStaticScreen;
this->GetDlgItem(IDC_STATIC_SCREEN)->GetWindowRect(&rectStaticScreen);
CString str;
str.Format("%d,%d;%d,%d",rectStaticScreen.left,rectStaticScreen.top,rectStaticScreen.right,rectStaticScreen.bottom);
// AfxMessageBox(str);
CClientDC dc(this);
dc.Rectangle(rectStaticScreen);
CBrush fillBrush(RGB(122,122,122));
dc.FillRect(&rectStaticScreen,&fillBrush);
dc.TextOut(rectStaticScreen.left,rectStaticScreen.top,"123",sizeof("123")-1);
}
运行得到如下效果:


{
// TODO: Add your control notification handler code here
CRect rectStaticScreen;
this->GetDlgItem(IDC_STATIC_SCREEN)->GetWindowRect(&rectStaticScreen);
CString str;
str.Format("%d,%d;%d,%d",rectStaticScreen.left,rectStaticScreen.top,rectStaticScreen.right,rectStaticScreen.bottom);
CClientDC dc(this);
dc.Rectangle(rectStaticScreen);
CBrush fillBrush(RGB(122,122,122));
dc.FillRect(&rectStaticScreen,&fillBrush);
dc.TextOut(rectStaticScreen.left,rectStaticScreen.top,"123",sizeof("123")-1);




