コード例 #1
0
        protected override DiagramShape CreateBackground()
        {
            PolygonGraph polygon1 = new PolygonGraph();

            polygon1.Shadowed   = true;
            polygon1.Selectable = false;
            polygon1.Pen        = DiagramGraph.Pens_LightGray;
            polygon1.Brush      = DiagramGraph.Brushes_LemonChiffon;
            return(polygon1);
        }
コード例 #2
0
        public override DiagramShape CopyObject(CopyDictionary env)
        {
            PolygonGraph polygon1 = (PolygonGraph)base.CopyObject(env);

            if (polygon1 != null)
            {
                polygon1.myPoints = (PointF[])this.myPoints.Clone();
            }
            return(polygon1);
        }
コード例 #3
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramText text1 = this.Label;
         if (text1 != null)
         {
             PolygonGraph polygon1 = base.Background as PolygonGraph;
             if ((polygon1 != null) && (childchanged != polygon1))
             {
                 SizeF      ef1     = this.TopLeftMargin;
                 SizeF      ef2     = this.BottomRightMargin;
                 RectangleF ef3     = new RectangleF(text1.Left - ef1.Width, text1.Top - ef1.Height, (text1.Width + ef1.Width) + ef2.Width, (text1.Height + ef1.Height) + ef2.Height);
                 SizeF      ef4     = this.Corner;
                 float      single1 = ef4.Width;
                 if (single1 > (ef3.Width / 2f))
                 {
                     single1 = ef3.Width / 2f;
                 }
                 float single2 = ef4.Height;
                 if (single2 > (ef3.Height / 2f))
                 {
                     single2 = ef3.Height / 2f;
                 }
                 float      single3  = ef3.X;
                 float      single4  = ef3.Y;
                 float      single5  = single3 + single1;
                 float      single6  = single4 + single2;
                 float      single7  = single3 + (ef3.Width / 2f);
                 float      single8  = single4 + (ef3.Height / 2f);
                 float      single9  = (single3 + ef3.Width) - single1;
                 float      single10 = (single4 + ef3.Height) - single2;
                 float      single11 = single3 + ef3.Width;
                 float      single12 = single4 + ef3.Height;
                 RectangleF ef5      = polygon1.Bounds;
                 bool       flag1    = base.SuspendsUpdates;
                 if (!flag1)
                 {
                     polygon1.Changing(0x584);
                 }
                 polygon1.SuspendsUpdates = true;
                 polygon1.ClearPoints();
                 if (this.Anchor != null)
                 {
                     PointF tf3;
                     PointF tf4;
                     float  single13 = System.Math.Min((float)(ef3.Width - single1), this.BaseWidth);
                     float  single14 = System.Math.Min((float)(ef3.Height - single2), this.BaseWidth);
                     float  single15 = text1.Left;
                     float  single16 = text1.Top;
                     float  single17 = text1.Right;
                     float  single18 = text1.Bottom;
                     PointF tf1      = text1.Center;
                     PointF tf2      = this.Anchor.Center;
                     text1.GetNearestIntersectionPoint(tf2, tf1, out tf3);
                     this.Anchor.GetNearestIntersectionPoint(tf1, tf2, out tf4);
                     if ((tf3.Y <= single16) && (tf3.X < single7))
                     {
                         polygon1.AddPoint(single3, single4);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single3 + single13, single4);
                     }
                     else
                     {
                         polygon1.AddPoint(single5, single4);
                     }
                     if ((tf3.Y <= single16) && (tf3.X >= single7))
                     {
                         polygon1.AddPoint(single11 - single13, single4);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single11, single4);
                     }
                     else
                     {
                         polygon1.AddPoint(single9, single4);
                     }
                     if ((tf3.X >= single17) & (tf3.Y < single8))
                     {
                         polygon1.AddPoint(single11, single4);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single11, single4 + single14);
                     }
                     else
                     {
                         polygon1.AddPoint(single11, single6);
                     }
                     if ((tf3.X >= single17) & (tf3.Y >= single8))
                     {
                         polygon1.AddPoint(single11, single12 - single14);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single11, single12);
                     }
                     else
                     {
                         polygon1.AddPoint(single11, single10);
                     }
                     if ((tf3.Y >= single18) && (tf3.X >= single7))
                     {
                         polygon1.AddPoint(single11, single12);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single11 - single13, single12);
                     }
                     else
                     {
                         polygon1.AddPoint(single9, single12);
                     }
                     if ((tf3.Y >= single18) && (tf3.X < single7))
                     {
                         polygon1.AddPoint(single3 + single13, single12);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single3, single12);
                     }
                     else
                     {
                         polygon1.AddPoint(single5, single12);
                     }
                     if ((tf3.X <= single15) && (tf3.Y >= single8))
                     {
                         polygon1.AddPoint(single3, single12);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single3, single12 - single14);
                     }
                     else
                     {
                         polygon1.AddPoint(single3, single10);
                     }
                     if ((tf3.X <= single15) && (tf3.Y < single8))
                     {
                         polygon1.AddPoint(single3, single4 + single14);
                         polygon1.AddPoint(tf4);
                         polygon1.AddPoint(single3, single4);
                     }
                     else
                     {
                         polygon1.AddPoint(single3, single6);
                     }
                 }
                 else
                 {
                     polygon1.AddPoint(single5, single4);
                     polygon1.AddPoint(single9, single4);
                     polygon1.AddPoint(single11, single6);
                     polygon1.AddPoint(single11, single10);
                     polygon1.AddPoint(single9, single12);
                     polygon1.AddPoint(single5, single12);
                     polygon1.AddPoint(single3, single10);
                     polygon1.AddPoint(single3, single6);
                 }
                 polygon1.SuspendsUpdates = flag1;
                 if (!flag1)
                 {
                     polygon1.Changed(0x584, 0, null, ef5, 0, null, polygon1.Bounds);
                 }
             }
         }
     }
 }