示例#1
0
        public override void Paint(Graphics g, DiagramView view)
        {
            RectangleF ef1 = this.Bounds;

            switch (this.Style)
            {
            case ShapeStyle.None:
            {
                return;
            }

            case ShapeStyle.Ellipse:
            {
                DiagramGraph.DrawEllipse(g, view, this.Pen, this.Brush, ef1.X, ef1.Y, ef1.Width, ef1.Height);
                return;
            }

            case ShapeStyle.Diamond:
            {
                PointF[] tfArray1 = view.AllocTempPointArray(4);
                tfArray1[0].X = ef1.X + (ef1.Width / 2f);
                tfArray1[0].Y = ef1.Y;
                tfArray1[1].X = ef1.X + ef1.Width;
                tfArray1[1].Y = ef1.Y + (ef1.Height / 2f);
                tfArray1[2].X = tfArray1[0].X;
                tfArray1[2].Y = ef1.Y + ef1.Height;
                tfArray1[3].X = ef1.X;
                tfArray1[3].Y = tfArray1[1].Y;
                DiagramGraph.DrawPolygon(g, view, this.Pen, this.Brush, tfArray1);
                view.FreeTempPointArray(tfArray1);
                return;
            }

            case ShapeStyle.TriangleTopLeft:
            case ShapeStyle.TriangleTopRight:
            case ShapeStyle.TriangleBottomRight:
            case ShapeStyle.TriangleBottomLeft:
            case ShapeStyle.TriangleMiddleTop:
            case ShapeStyle.TriangleMiddleRight:
            case ShapeStyle.TriangleMiddleBottom:
            case ShapeStyle.TriangleMiddleLeft:
            {
                PointF[] tfArray2 = view.AllocTempPointArray(3);
                this.ComputeTrianglePoints(tfArray2);
                DiagramGraph.DrawPolygon(g, view, this.Pen, this.Brush, tfArray2);
                view.FreeTempPointArray(tfArray2);
                return;
            }
            }
            DiagramGraph.DrawRectangle(g, view, this.Pen, this.Brush, ef1.X, ef1.Y, ef1.Width, ef1.Height);
        }
示例#2
0
        protected virtual void PaintButton(Graphics g, DiagramView view)
        {
            Pen        pen1;
            Pen        pen2;
            Pen        pen3;
            Pen        pen4;
            RectangleF ef1 = this.Bounds;

            if (this.ActionActivated)
            {
                pen1 = DiagramGraph.SystemPens_ControlDarkDark;
                pen2 = DiagramGraph.SystemPens_ControlLightLight;
                pen3 = DiagramGraph.SystemPens_ControlDark;
                pen4 = DiagramGraph.SystemPens_Control;
            }
            else
            {
                pen1 = DiagramGraph.SystemPens_ControlLightLight;
                pen2 = DiagramGraph.SystemPens_ControlDarkDark;
                pen3 = DiagramGraph.SystemPens_Control;
                pen4 = DiagramGraph.SystemPens_ControlDark;
            }
            PointF[] tfArray1 = view.AllocTempPointArray(3);
            float    single1  = 0.5f;
            float    single2  = 0.5f;

            if (base.Document != null)
            {
                single1 /= base.Document.WorldScale.Width;
                single2 /= base.Document.WorldScale.Height;
            }
            PointF tf1 = new PointF(ef1.X + single1, ef1.Y + single2);
            PointF tf2 = new PointF((ef1.X + ef1.Width) - single1, ef1.Y + single2);
            PointF tf3 = new PointF(ef1.X + single1, (ef1.Y + ef1.Height) - single2);
            PointF tf4 = new PointF((ef1.X + ef1.Width) - single1, (ef1.Y + ef1.Height) - single2);

            tfArray1[0] = tf2;
            tfArray1[1] = tf1;
            tfArray1[2] = tf3;
            DiagramGraph.DrawLines(g, view, pen3, tfArray1);
            tfArray1[0].Y -= single2;
            tfArray1[1]    = tf4;
            tfArray1[2].X -= single1;
            DiagramGraph.DrawLines(g, view, pen4, tfArray1);
            tf1.X      -= (single1 * 2f);
            tf1.Y      -= (single2 * 2f);
            tf2.X      += (single1 * 2f);
            tf2.Y      -= (single2 * 2f);
            tf4.X      += (single1 * 2f);
            tf4.Y      += (single2 * 2f);
            tf3.X      -= (single1 * 2f);
            tf3.Y      += (single2 * 2f);
            tfArray1[0] = tf2;
            tfArray1[1] = tf1;
            tfArray1[2] = tf3;
            DiagramGraph.DrawLines(g, view, pen1, tfArray1);
            tfArray1[0].Y -= single2;
            tfArray1[1]    = tf4;
            tfArray1[2].X -= single1;
            DiagramGraph.DrawLines(g, view, pen2, tfArray1);
            view.FreeTempPointArray(tfArray1);
        }
示例#3
0
 public override void Paint(Graphics g, DiagramView view)
 {
     RectangleF ef1 = this.Bounds;
     switch (this.Style)
     {
         case ShapeStyle.None:
             {
                 return;
             }
         case ShapeStyle.Ellipse:
             {
                 DiagramGraph.DrawEllipse(g, view, this.Pen, this.Brush, ef1.X, ef1.Y, ef1.Width, ef1.Height);
                 return;
             }
         case ShapeStyle.Diamond:
             {
                 PointF[] tfArray1 = view.AllocTempPointArray(4);
                 tfArray1[0].X = ef1.X + (ef1.Width / 2f);
                 tfArray1[0].Y = ef1.Y;
                 tfArray1[1].X = ef1.X + ef1.Width;
                 tfArray1[1].Y = ef1.Y + (ef1.Height / 2f);
                 tfArray1[2].X = tfArray1[0].X;
                 tfArray1[2].Y = ef1.Y + ef1.Height;
                 tfArray1[3].X = ef1.X;
                 tfArray1[3].Y = tfArray1[1].Y;
                 DiagramGraph.DrawPolygon(g, view, this.Pen, this.Brush, tfArray1);
                 view.FreeTempPointArray(tfArray1);
                 return;
             }
         case ShapeStyle.TriangleTopLeft:
         case ShapeStyle.TriangleTopRight:
         case ShapeStyle.TriangleBottomRight:
         case ShapeStyle.TriangleBottomLeft:
         case ShapeStyle.TriangleMiddleTop:
         case ShapeStyle.TriangleMiddleRight:
         case ShapeStyle.TriangleMiddleBottom:
         case ShapeStyle.TriangleMiddleLeft:
             {
                 PointF[] tfArray2 = view.AllocTempPointArray(3);
                 this.ComputeTrianglePoints(tfArray2);
                 DiagramGraph.DrawPolygon(g, view, this.Pen, this.Brush, tfArray2);
                 view.FreeTempPointArray(tfArray2);
                 return;
             }
     }
     DiagramGraph.DrawRectangle(g, view, this.Pen, this.Brush, ef1.X, ef1.Y, ef1.Width, ef1.Height);
 }