void Canvas::DrawButton(PixelRect rc, bool down) { const Pen old_pen = pen; Color gray = IsDithered() ? (down ? COLOR_BLACK : COLOR_WHITE) : COLOR_LIGHT_GRAY; DrawFilledRectangle(rc, gray); Pen bright(1, IsDithered() ? COLOR_BLACK : LightColor(gray)); Pen dark(1, IsDithered() ? COLOR_BLACK : DarkColor(gray)); Select(down ? dark : bright); DrawTwoLinesExact(rc.left, rc.bottom - 2, rc.left, rc.top, rc.right - 2, rc.top); DrawTwoLinesExact(rc.left + 1, rc.bottom - 3, rc.left + 1, rc.top + 1, rc.right - 3, rc.top + 1); Select(down ? bright : dark); DrawTwoLinesExact(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1, rc.right - 1, rc.top + 1); DrawTwoLinesExact(rc.left + 2, rc.bottom - 2, rc.right - 2, rc.bottom - 2, rc.right - 2, rc.top + 2); pen = old_pen; }
void Canvas::DrawRaisedEdge(PixelRect &rc) { Pen bright(1, Color(240, 240, 240)); Select(bright); DrawTwoLinesExact(rc.left, rc.bottom - 2, rc.left, rc.top, rc.right - 2, rc.top); Pen dark(1, Color(128, 128, 128)); Select(dark); DrawTwoLinesExact(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1, rc.right - 1, rc.top + 1); ++rc.left; ++rc.top; --rc.right; --rc.bottom; }