/// <summary> /// Paints the shape of the person object in the plex. Here you can let your imagination go. /// </summary> /// <param name="g">The graphics canvas onto which to paint</param> public override void Paint(Graphics g) { //g.FillRectangle(Brushes.Red,this.Rectangle.X-100,this.Rectangle.Y-100,20,20); if (RecalculateSize) { Rectangle = new RectangleF(new PointF(Rectangle.X, Rectangle.Y), g.MeasureString(Text, Font)); RecalculateSize = false; //very important! } g.FillRectangle(BackgroundBrush, Rectangle.X, Rectangle.Y, Rectangle.Width + 1, Rectangle.Height + 1); g.DrawRectangle(Pen, Rectangle.X, Rectangle.Y, Rectangle.Width + 1, Rectangle.Height + 1); combo.Location = new Point((int)Rectangle.X + 10, (int)Rectangle.Y + 20); combo.Paint(g); if (ShowLabel) { StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; g.DrawString(Text, Font, TextBrush, Rectangle.X + (Rectangle.Width / 2), Rectangle.Y + 3, sf); } base.Paint(g); }