4.改变画图颜色 2.1 void CBmp TestDlg: OnPaint if ( lsIconicO) ∥与前一页代码相同; else CPaintDC dc(this); /device context for painting CPen newpen(PS SOLID, 1, RGB(0, 255, 0)) CBrush newbrush(RGB(0, 0, 255)) CPen *pOldpen=dc Selectobject(&newpen) CBrush *pOldbrush=dc Selectobject(&newbrush) dc MoveTo(10, 10) dc LineTo(100, 100) dc. B ipse(8080,120.12 dc Selectobject(poldpen); dc Selectobject(poldbrush) CDialog On Paint2.1 void CBmpTestDlg::OnPaint() { if (IsIconic()) { //与前一页代码相同; else { CPaintDC dc(this); // device context for painting CPen newpen(PS_SOLID,1,RGB(0,255,0)); CBrush newbrush(RGB(0,0,255)); CPen *pOldpen=dc.SelectObject(&newpen); CBrush *pOldbrush=dc.SelectObject(&newbrush); dc.MoveTo(10,10); dc.LineTo(100,100); dc.Ellipse(80,80,120,120); dc.SelectObject(pOldpen); dc.SelectObject(pOldbrush); CDialog::OnPaint(); } } 4.改变画图颜色