Example #1
0
        private void DrawShape(Graphics g, DecorationMode mode, DecorationShape ds, Pen pen, Rectangle rect)
        {
            const int margin = 5;

            Rectangle where = rect;
            where.Inflate(-margin, 0);
            if (mode == DecorationMode.None)
            {
                return;
            }
            switch (ds)
            {
            case DecorationShape.Rectangle:
                g.DrawRectangle(pen, where);
                break;

            case DecorationShape.Ellipse:
                g.DrawEllipse(pen, where);
                break;

            case DecorationShape.Cross:
                g.DrawLine(pen, new Point(where.X, where.Y), new Point(where.X + where.Width, where.Y + where.Height));
                g.DrawLine(pen, new Point(where.X + where.Width, where.Y), new Point(where.X, where.Y + where.Height));
                break;

            default:
                throw new Exception("Unknown shape");
            }
        }
Example #2
0
 public Decoration(DecorationMode mode, DecorationShape shape, PenStyle penstyle, int padding)
 {
     this.mode     = mode;
     this.shape    = shape;
     this.penstyle = penstyle;
     this.padding  = padding;
 }
Example #3
0
 public Decoration(DecorationMode mode, DecorationShape shape)
 {
     this.mode     = mode;
     this.shape    = shape;
     this.penstyle = new PenStyle(Color.Black, 1.0f, DashStyle.Solid, ArrowStyle.None);
     this.padding  = 4;
 }
Example #4
0
 public Decoration(DecorationMode mode, DecorationShape shape)
 {
     this.mode = mode;
     this.shape = shape;
     this.penstyle = new PenStyle(Color.Black, 1.0f, DashStyle.Solid, ArrowStyle.None);
     this.padding = 4;
 }
Example #5
0
 public Decoration(DecorationMode mode, DecorationShape shape, PenStyle penstyle, int padding)
 {
     this.mode = mode;
     this.shape = shape;
     this.penstyle = penstyle;
     this.padding = padding;
 }
Example #6
0
 private void DrawShape(Graphics g, DecorationMode mode, DecorationShape ds, Pen pen, Rectangle rect)
 {
     const int margin = 5;
     Rectangle where = rect;
     where.Inflate(-margin, 0);
     if (mode == DecorationMode.None)
         return;
     switch (ds)
     {
         case DecorationShape.Rectangle:
             g.DrawRectangle(pen, where);
             break;
         case DecorationShape.Ellipse:
             g.DrawEllipse(pen, where);
             break;
         case DecorationShape.Cross:
             g.DrawLine(pen, new Point(where.X, where.Y), new Point(where.X + where.Width, where.Y + where.Height));
             g.DrawLine(pen, new Point(where.X + where.Width, where.Y), new Point(where.X, where.Y + where.Height));
             break;
         default:
             throw new Exception("Unknown shape");
     }
 }