使用GDI绘制假按钮

void CFakeButtonView::OnDraw(CDC* /*pDC*/) { CFakeButtonDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; CDC* pDC = GetDC(); //绘制命令按钮 CRect rt(100, 110, 220, 150); pDC->DrawFrameControl(rt, DFC_BUTTON, DFCS_BUTTONPUSH); //输出文字 pDC->SetBkMode(TRANSPARENT); pDC->TextOut(120, 120, _T("Hello,World!")); rt.DeflateRect(3,3); pDC->DrawFocusRect(rt); //复选框 pDC->DrawFrameControl(CRect(100,180,220,194), DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_CHECKED); //单选按钮 pDC->DrawFrameControl(CRect(100,200,220,214), DFC_BUTTON, DFCS_BUTTONRADIO | DFCS_CHECKED); //滚动条 pDC->DrawFrameControl(CRect(100,220,220,240), DFC_SCROLL, DFCS_SCROLLUP); pDC->DrawFrameControl(CRect(100,240,220,260), DFC_SCROLL, DFCS_SCROLLDOWN); } 

你可能感兴趣的:(使用GDI绘制假按钮)