/// <summary> /// Draw a representation of our value /// </summary> public override void PaintValue(PaintValueEventArgs e) { IBrushData bd = e.Value as IBrushData; if (bd == null) { base.PaintValue(e); } else { e.Graphics.FillRectangle(BlockFormat.PrepareBrushForDrawing(bd.GetBrush(), e.Bounds), e.Bounds); } }
virtual protected void HandlePaintEvent(Graphics g, Rectangle r) { using (Brush b = this.GetBrush()) { StringFormat fmt = new StringFormat(); fmt.Alignment = StringAlignment.Center; fmt.LineAlignment = StringAlignment.Center; if (b == null) { g.DrawString("No brush", new Font("Tahoma", 14), Brushes.DarkGray, r, fmt); } else { g.DrawString("Through a mirror darkly", new Font("Tahoma", 14), Brushes.Black, r, fmt); g.FillRectangle(BlockFormat.PrepareBrushForDrawing(b, r), r); } } }