示例#1
0
 private void Annotate(System.Drawing.Graphics g, Size s, double height)
 {
     // *** Annotate : begin ***
     if (height > 0)
     {
         string annotation = string.Format(
             "{0}*{1}={2}"
             , _layer.Count
             , _layer.NoLayers(height)
             , _layer.CountInHeight(height));
         Font         tfont = new Font("Arial", _fontSize);
         StringFormat sf    = new StringFormat {
             Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Far
         };
         Size txtSize = g.MeasureString(annotation, tfont).ToSize();
         g.FillRectangle(new SolidBrush(Color.Black), new Rectangle(s.Width - txtSize.Width - 2, s.Height - txtSize.Height - 2, txtSize.Width + 2, txtSize.Height + 2));
         g.DrawString(annotation, tfont, new SolidBrush(Color.White), new Point(s.Width - 3, s.Height - 3), sf);
     }
     // *** Annotate : end ***
 }