Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/10 13:40:32 (15 years ago)
Author:
mkommend
Message:

adapted OperatorShapeInfo to resize header section according to the title string (ticket #867)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/OperatorShape.cs

    r2935 r3169  
    3535    private static int LABEL_WIDTH = 180;
    3636    private static int LABEL_SPACING = 3;
    37     private static int HEADER_HEIGHT = 30;
     37    private int headerHeight = 30;
    3838
    3939    private ExpandableIconMaterial expandIconMaterial;
     
    168168    private Size CalculateSize() {
    169169      int width = this.Rectangle.Width;
    170       int height = HEADER_HEIGHT;
     170      int height = headerHeight;
    171171      if (!Collapsed)
    172172        height += this.labels.Count * (LABEL_HEIGHT + LABEL_SPACING);
     
    189189
    190190      //the initial size
    191       this.Transform(0, 0, 200, HEADER_HEIGHT);
     191      this.Transform(0, 0, 200, headerHeight);
    192192      this.color = Color.LightBlue;
    193193
     
    218218      g.SmoothingMode = SmoothingMode.HighQuality;
    219219
    220       Pen pen = new Pen(lineColor,lineWidth);
     220      Pen pen = new Pen(lineColor, lineWidth);
     221
     222      SizeF titleSize = g.MeasureString(this.Title, ArtPalette.DefaultBoldFont, Rectangle.Width - 45);
     223      if (titleSize.Height + 10 > Rectangle.Height) {
     224        headerHeight =  (int)titleSize.Height + 10;
     225        mRectangle.Height = headerHeight;
     226      }
    221227
    222228      GraphicsPath path = new GraphicsPath();
     
    251257
    252258        for (int i = 0; i < this.labels.Count; i++) {
    253           rect = new Rectangle(Rectangle.X + 25, Rectangle.Y + HEADER_HEIGHT + i * (LABEL_HEIGHT + LABEL_SPACING), LABEL_WIDTH, LABEL_HEIGHT);
     259          rect = new Rectangle(Rectangle.X + 25, Rectangle.Y + headerHeight + i * (LABEL_HEIGHT + LABEL_SPACING), LABEL_WIDTH, LABEL_HEIGHT);
    254260          g.DrawString(textStyle.GetFormattedText(this.labels[i]), textStyle.Font, textStyle.GetBrush(), rect, stringFormat);
    255261        }
     
    260266
    261267      //the title
    262       g.DrawString(this.Title, ArtPalette.DefaultBoldFont, Brushes.Black, new Rectangle(Rectangle.X + 25, Rectangle.Y + 5, Rectangle.Width - 45, 27));
     268      g.DrawString(this.Title, ArtPalette.DefaultBoldFont, Brushes.Black, new Rectangle(Rectangle.X + 25, Rectangle.Y + 5, Rectangle.Width - 45, Rectangle.Height - 5));
     269
    263270
    264271      //the material
Note: See TracChangeset for help on using the changeset viewer.