记在博客上永久保存~
void CMy001Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
CDC *pDC;
pDC = new CClientDC(GetDlgItem(IDC_STATIC_1));//得到STATIC控件DC
CPen pen(PS_SOLID,1,RGB(255,0,0));
CPen *pOldPen = pDC->SelectObject(&pen);
//
//各种绘图操作
pDC->Rectangle(0,0,20,20);
//
pDC->SelectObject(pOldPen);
delete pDC;
}