Changeset 4779


Ignore:
Timestamp:
11/12/10 12:48:41 (9 years ago)
Author:
mkommend
Message:

Improved statistics section of StringConvertibleMatrixView (ticket #1253).

Location:
trunk/sources/HeuristicLab.Data.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.Designer.cs

    r4709 r4779  
    5454      this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
    5555      this.ShowHideColumns = new System.Windows.Forms.ToolStripMenuItem();
    56       this.statusStrip = new System.Windows.Forms.StatusStrip();
    57       this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
     56      this.statisticsTextBox = new System.Windows.Forms.TextBox();
    5857      ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
    5958      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6059      this.contextMenu.SuspendLayout();
    61       this.statusStrip.SuspendLayout();
    6260      this.SuspendLayout();
    6361      //
     
    9694      this.dataGridView.Name = "dataGridView";
    9795      this.dataGridView.RowHeadersWidth = 160;
    98       this.dataGridView.Size = new System.Drawing.Size(424, 327);
     96      this.dataGridView.Size = new System.Drawing.Size(424, 330);
    9997      this.dataGridView.TabIndex = 4;
    10098      this.dataGridView.VirtualMode = true;
     
    150148      this.ShowHideColumns.Click += new System.EventHandler(this.ShowHideColumns_Click);
    151149      //
    152       // statusStrip1
     150      // statisticsTextBox
    153151      //
    154       this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    155             this.toolStripStatusLabel});
    156       this.statusStrip.Location = new System.Drawing.Point(0, 382);
    157       this.statusStrip.Name = "statusStrip1";
    158       this.statusStrip.Size = new System.Drawing.Size(424, 22);
    159       this.statusStrip.TabIndex = 5;
    160       this.statusStrip.Text = "statusStrip1";
    161       //
    162       // toolStripStatusLabel
    163       //
    164       this.toolStripStatusLabel.Name = "toolStripStatusLabel";
    165       this.toolStripStatusLabel.Size = new System.Drawing.Size(378, 17);
    166       this.toolStripStatusLabel.Spring = true;
     152      this.statisticsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
     153                  | System.Windows.Forms.AnchorStyles.Right)));
     154      this.statisticsTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
     155      this.statisticsTextBox.Location = new System.Drawing.Point(3, 388);
     156      this.statisticsTextBox.Name = "statisticsTextBox";
     157      this.statisticsTextBox.Size = new System.Drawing.Size(418, 13);
     158      this.statisticsTextBox.TabIndex = 5;
     159      this.statisticsTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
    167160      //
    168161      // StringConvertibleMatrixView
     
    170163      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    171164      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    172       this.Controls.Add(this.statusStrip);
     165      this.Controls.Add(this.columnsTextBox);
    173166      this.Controls.Add(this.dataGridView);
    174       this.Controls.Add(this.columnsTextBox);
    175167      this.Controls.Add(this.rowsTextBox);
    176168      this.Controls.Add(this.columnsLabel);
    177169      this.Controls.Add(this.rowsLabel);
     170      this.Controls.Add(this.statisticsTextBox);
    178171      this.Name = "StringConvertibleMatrixView";
    179172      this.Size = new System.Drawing.Size(424, 404);
     
    181174      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    182175      this.contextMenu.ResumeLayout(false);
    183       this.statusStrip.ResumeLayout(false);
    184       this.statusStrip.PerformLayout();
    185176      this.ResumeLayout(false);
    186177      this.PerformLayout();
     
    197188    protected System.Windows.Forms.ToolStripMenuItem ShowHideColumns;
    198189    protected System.Windows.Forms.DataGridView dataGridView;
    199     private System.Windows.Forms.StatusStrip statusStrip;
    200     private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel;
     190    protected System.Windows.Forms.TextBox statisticsTextBox;
    201191
    202192  }
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r4720 r4779  
    510510
    511511    private void UpdateVisibilityOfStatisticalInformation() {
    512       statusStrip.Visible = showStatisticalInformation;
     512      statisticsTextBox.Visible = showStatisticalInformation;
    513513      UpdateDataGridViewSizeAndLocation();
    514514    }
     
    521521      dataGridView.Location = new Point(0, offset);
    522522
    523       int statusStripHeight = showStatisticalInformation ? statusStrip.Height : 0;
    524       dataGridView.Size = new Size(Size.Width, Size.Height - offset - statusStripHeight);
     523      int statisticsTextBoxHeight = showStatisticalInformation ? statisticsTextBox.Height + statisticsTextBox.Margin.Top + statisticsTextBox.Margin.Bottom : 0;
     524      dataGridView.Size = new Size(Size.Width, Size.Height - offset - statisticsTextBoxHeight);
    525525    }
    526526
    527527    private void dataGridView_SelectionChanged(object sender, EventArgs e) {
    528       toolStripStatusLabel.Text = string.Empty;
     528      string stringFormat = "{0,20:0.0000}";
     529      statisticsTextBox.Text = string.Empty;
    529530      if (dataGridView.SelectedCells.Count > 1) {
    530531        List<double> selectedValues = new List<double>();
     
    536537        if (selectedValues.Count > 1) {
    537538          StringBuilder labelText = new StringBuilder();
    538           labelText.Append("Count: " + selectedValues.Count + "    ");
    539           labelText.Append("Sum: " + selectedValues.Sum() + "    ");
    540           labelText.Append("Min: " + selectedValues.Min() + "    ");
    541           labelText.Append("Max: " + selectedValues.Max() + "    ");
    542           labelText.Append("Average: " + selectedValues.Average() + "    ");
    543           labelText.Append("Standard Deviation: " + selectedValues.StandardDeviation() + "    ");
    544 
    545           toolStripStatusLabel.Text = labelText.ToString();
     539          labelText.Append("Count: " + string.Format(stringFormat, selectedValues.Count) + "    ");
     540          labelText.Append("Sum: " + string.Format(stringFormat, selectedValues.Sum()) + "    ");
     541          labelText.Append("Min: " + string.Format(stringFormat, selectedValues.Min()) + "    ");
     542          labelText.Append("Max: " + string.Format(stringFormat, selectedValues.Max()) + "    ");
     543          labelText.Append("Average: " + string.Format(stringFormat, selectedValues.Average()) + "    ");
     544          labelText.Append("Standard Deviation: " + string.Format(stringFormat, selectedValues.StandardDeviation()) + "    ");
     545
     546          statisticsTextBox.Text = labelText.ToString();
    546547        }
    547548      }
Note: See TracChangeset for help on using the changeset viewer.