void drawTo(Graphics g) { // Background // Brush brushBackground = new SolidBrush(BackColor); // g.FillRectangle(brushBackground, this.ClientRectangle); Rectangle sel, up, down; sel = new Rectangle(); up = new Rectangle(); down = new Rectangle(); getFrames(ref sel, ref up, ref down); if ((_title != null) && (_title.Length > 0)) { Brush tBrush = new SolidBrush(_titleColor); GraphicsUtil.drawText(g, Vector.V(sel.Left, Height / 2), _titleFont, scale, _title, 0, 2, 1, 0, Vector.V(1, 0), tBrush); } Pen framePen = new Pen(frontColor); g.DrawRectangle(framePen, sel); sel.Inflate(-1, -1); switch (_choiceType) { case ChoiceType.ListDefined: if ((_entries != null) && (_entries.Count > 0) && (selectedItem >= 0) && (selectedItem < _entries.Count)) { _entries[_selectedItem].draw(g, backColor, frontColor, sel); } if ((_entries != null) && (_entries.Count > 0)) { if (_selectedItem < _entries.Count - 1) { GraphicsUtil.drawTriangle(g, Vector.V(up), (double)up.Height, Vector.V(0, -1), framePen); } if (_selectedItem > 0) { GraphicsUtil.drawTriangle(g, Vector.V(down), (double)up.Height, Vector.V(0, 1), framePen); } } break; case ChoiceType.Numeric: g.FillRectangle(backBrush, sel); g.DrawRectangle(framePen, sel); GraphicsUtil.drawText(g, Vector.V(sel), _valueFont, scale, String.Format("{0}", _numericMin + _selectedItem), 0, 2, 0, 0, Vector.X, frontBrush); if (_selectedItem < (_numericMax - _numericMin)) { GraphicsUtil.drawTriangle(g, Vector.V(up), (double)up.Height, Vector.V(0, -1), framePen); } if (_selectedItem > 0) { GraphicsUtil.drawTriangle(g, Vector.V(down), (double)up.Height, Vector.V(0, 1), framePen); } break; case ChoiceType.NumericOff: g.FillRectangle(backBrush, sel); g.DrawRectangle(framePen, sel); if (_selectedItem == -1) { GraphicsUtil.drawText(g, Vector.V(sel), _valueFont, scale, _offString, 0, 2, 0, 0, Vector.X, frontBrush); } else { GraphicsUtil.drawText(g, Vector.V(sel), _valueFont, scale, String.Format("{0}", _numericMin + _selectedItem), 0, 2, 0, 0, Vector.X, frontBrush); } if (_selectedItem < (_numericMax - _numericMin)) { GraphicsUtil.drawTriangle(g, Vector.V(up), (double)up.Height, Vector.V(0, -1), framePen); } if (_selectedItem >= 0) { GraphicsUtil.drawTriangle(g, Vector.V(down), (double)up.Height, Vector.V(0, 1), framePen); } break; } }