void CXySlider::PaintBackground(CDC *pdc) { pdc->FillSolidRect(m_rcAll, ::GetSysColor(COLOR_BTNFACE)); CRect rc = m_rcInner; pdc->DrawEdge(rc, EDGE_SUNKEN, BF_RECT | BF_ADJUST); pdc->FillSolidRect(rc, RGB(255,255,255)); CPen pen(PS_SOLID, 1, ::GetSysColor(COLOR_3DLIGHT)); CSelectObject sopen(pdc, &pen); pdc->MoveTo(rc.left, m_zero.y); pdc->LineTo(rc.right, m_zero.y); pdc->MoveTo(m_zero.x, rc.top); pdc->LineTo(m_zero.x, rc.bottom); CRect circle = m_rcAll; circle.DeflateRect(m_gripperRadius); CSelectStockObject sobrush(pdc, NULL_BRUSH); pdc->Ellipse(circle); if(GetFocus() == this) { pdc->DrawFocusRect(m_rcAll); } }
void CPacman::Draw(CDC *pdc, const CRect& rect) { pdc->FillSolidRect(rect, m_bgcolor); CRect rc= rect; rc.DeflateRect(5, 1); if (rc.Height() % 2 == 0) rc.bottom--; int diameter= rc.Height(); int left= rc.left + (int)(m_position * (rc.Width() - diameter)); rc.left= left; rc.right= left + diameter; CPen pen(PS_SOLID, 1, RGB(0,0,0)); CSelectObject sopen(pdc, &pen); CBrush brush(CalculateColor()); CSelectObject sobrush(pdc, &brush); CPoint ptStart; CPoint ptEnd; int hmiddle= rc.top + diameter / 2; int mouthcy= (int)(m_aperture * m_aperture * diameter); int upperMouthcy= mouthcy; int lowerMouthcy= mouthcy; // It's the sad truth, that CDC::Pie() behaves different on // Windows 9x than on NT. if (!m_isWindows9x) lowerMouthcy++; if (m_toTheRight) { ptStart.x= ptEnd.x= rc.right; ptStart.y = hmiddle - upperMouthcy; ptEnd.y = hmiddle + lowerMouthcy; } else { ptStart.x= ptEnd.x= rc.left; ptStart.y = hmiddle + lowerMouthcy; ptEnd.y = hmiddle - upperMouthcy; } pdc->Pie(rc, ptStart, ptEnd); }
void CItem::DrawAdditionalState(CDC *pdc, const CRect& rcLabel) const { if (!IsRootItem() && this == GetDocument()->GetZoomItem()) { CRect rc = rcLabel; rc.InflateRect(1, 0); rc.bottom++; CSelectStockObject sobrush(pdc, NULL_BRUSH); CPen pen(PS_SOLID, 2, GetDocument()->GetZoomColor()); CSelectObject sopen(pdc, &pen); pdc->Rectangle(rc); } }
void CTreemap::DrawColorPreview(CDC *pdc, const CRect& rc, COLORREF color, const Options *options) { if (options != NULL) SetOptions(options); double surface[4]; for (int i=0; i < 4; i++) surface[i]= 0; AddRidge(rc, surface, m_options.height * m_options.scaleFactor); RenderRectangle(pdc, rc, surface, color); if (m_options.grid) { CPen pen(PS_SOLID, 1, m_options.gridColor); CSelectObject sopen(pdc, &pen); CSelectStockObject sobrush(pdc, NULL_BRUSH); pdc->Rectangle(rc); } }