Exemplo n.º 1
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramText text1 = this.Label;
         if (text1 != null)
         {
             DiagramShape obj1 = this.Background;
             if (obj1 != null)
             {
                 SizeF ef1 = this.TopLeftMargin;
                 SizeF ef2 = this.BottomRightMargin;
                 if (this.AutoResizes)
                 {
                     obj1.Bounds = new RectangleF(text1.Left - ef1.Width, text1.Top - ef1.Height, (text1.Width + ef1.Width) + ef2.Width, (text1.Height + ef1.Height) + ef2.Height);
                 }
                 else
                 {
                     float single1 = System.Math.Max((float)(obj1.Width - (ef1.Width + ef2.Width)), (float)0f);
                     float single2 = System.Math.Max((float)(obj1.Height - (ef1.Height + ef2.Height)), (float)0f);
                     text1.Width         = single1;
                     text1.WrappingWidth = single1;
                     text1.UpdateSize();
                     float single3 = System.Math.Min(text1.Height, single2);
                     float single4 = obj1.Left + ef1.Width;
                     float single5 = (obj1.Top + ef1.Height) + ((single2 - single3) / 2f);
                     text1.Bounds = new RectangleF(single4, single5, single1, single3);
                 }
             }
             if ((obj1 == null) && this.AutoResizes)
             {
                 obj1 = text1;
             }
             if (obj1 != null)
             {
                 if (this.TopPort != null)
                 {
                     this.TopPort.SetSpotLocation(0x20, obj1, 0x20);
                 }
                 if (this.RightPort != null)
                 {
                     this.RightPort.SetSpotLocation(0x40, obj1, 0x40);
                 }
                 if (this.BottomPort != null)
                 {
                     this.BottomPort.SetSpotLocation(0x80, obj1, 0x80);
                 }
                 if (this.LeftPort != null)
                 {
                     this.LeftPort.SetSpotLocation(0x100, obj1, 0x100);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramGraph shape1 = this.Shape;
         if (shape1 != null)
         {
             DiagramText text1 = this.Label;
             if (text1 != null)
             {
                 if (this.LabelSpot == 1)
                 {
                     PointF tf1 = shape1.Center;
                     SizeF  ef1 = this.MiddleLabelMargin;
                     if (this.AutoResizes)
                     {
                         float single1 = text1.Width + ef1.Width;
                         float single2 = text1.Height + ef1.Height;
                         shape1.Bounds = new RectangleF(tf1.X - (single1 / 2f), tf1.Y - (single2 / 2f), single1, single2);
                     }
                     else
                     {
                         float single3 = System.Math.Max((float)(shape1.Width - (ef1.Width + ef1.Width)), (float)0f);
                         float single4 = System.Math.Max((float)(shape1.Height - (ef1.Height + ef1.Height)), (float)0f);
                         text1.Width         = single3;
                         text1.WrappingWidth = single3;
                         text1.UpdateSize();
                         float single5 = System.Math.Min(text1.Height, single4);
                         float single6 = shape1.Left + ef1.Width;
                         float single7 = (shape1.Top + ef1.Height) + ((single4 - single5) / 2f);
                         text1.Bounds = new RectangleF(single6, single7, single3, single5);
                     }
                     text1.Alignment = 1;
                     text1.Center    = tf1;
                     if (this.Port != null)
                     {
                         this.Port.Bounds = shape1.Bounds;
                     }
                 }
                 else
                 {
                     text1.Alignment = this.SpotOpposite(this.LabelSpot);
                     text1.SetSpotLocation(this.SpotOpposite(this.LabelSpot), shape1, this.LabelSpot);
                 }
             }
             if (this.Port != null)
             {
                 this.Port.SetSpotLocation(1, shape1, 1);
             }
         }
     }
 }