Exemplo n.º 1
0
 protected override void HandlePaintEvent(Graphics g, Rectangle r)
 {
     using (Pen p = this.GetPen()) {
         g.SmoothingMode = ObjectListView.SmoothingMode;
         StringFormat fmt = new StringFormat();
         fmt.Alignment     = StringAlignment.Center;
         fmt.LineAlignment = StringAlignment.Center;
         if (p == null)
         {
             g.DrawString("No pen", new Font("Tahoma", 14), Brushes.DarkGray, r, fmt);
         }
         else
         {
             g.DrawString("Through a mirror darkly", new Font("Tahoma", 14), Brushes.Black, r, fmt);
             int inset = (int)Math.Max(1.0, p.Width);
             r.Inflate(-inset, -inset);
             Point[] pts = new Point[4];
             pts[0] = r.Location;
             pts[1] = new Point(r.X + r.Width / 2, r.Bottom);
             pts[2] = new Point(r.X + r.Width / 2, r.Top);
             pts[3] = new Point(r.Right, r.Bottom);
             g.DrawLines(BlockFormat.PreparePenForDrawing(p, r), pts);
         }
     }
 }