Changeset 4709 for trunk/sources/HeuristicLab.Data.Views
- Timestamp:
- 11/02/10 15:30:42 (13 years ago)
- 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
r4477 r4709 54 54 this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); 55 55 this.ShowHideColumns = new System.Windows.Forms.ToolStripMenuItem(); 56 this.statusStrip = new System.Windows.Forms.StatusStrip(); 57 this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); 56 58 ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); 57 59 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 58 60 this.contextMenu.SuspendLayout(); 61 this.statusStrip.SuspendLayout(); 59 62 this.SuspendLayout(); 60 63 // … … 93 96 this.dataGridView.Name = "dataGridView"; 94 97 this.dataGridView.RowHeadersWidth = 160; 95 this.dataGridView.Size = new System.Drawing.Size(424, 3 52);98 this.dataGridView.Size = new System.Drawing.Size(424, 327); 96 99 this.dataGridView.TabIndex = 4; 97 100 this.dataGridView.VirtualMode = true; … … 102 105 this.dataGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView_ColumnHeaderMouseClick); 103 106 this.dataGridView.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dataGridView_Scroll); 107 this.dataGridView.SelectionChanged += new System.EventHandler(this.dataGridView_SelectionChanged); 104 108 this.dataGridView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView_KeyDown); 105 this.dataGridView.MouseClick += new System.Windows.Forms.MouseEventHandler( dataGridView_MouseClick);109 this.dataGridView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dataGridView_MouseClick); 106 110 this.dataGridView.Resize += new System.EventHandler(this.dataGridView_Resize); 107 111 // … … 146 150 this.ShowHideColumns.Click += new System.EventHandler(this.ShowHideColumns_Click); 147 151 // 152 // statusStrip1 153 // 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; 167 // 148 168 // StringConvertibleMatrixView 149 169 // 150 170 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 151 171 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 172 this.Controls.Add(this.statusStrip); 152 173 this.Controls.Add(this.dataGridView); 153 174 this.Controls.Add(this.columnsTextBox); … … 160 181 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 161 182 this.contextMenu.ResumeLayout(false); 183 this.statusStrip.ResumeLayout(false); 184 this.statusStrip.PerformLayout(); 162 185 this.ResumeLayout(false); 163 186 this.PerformLayout(); … … 174 197 protected System.Windows.Forms.ToolStripMenuItem ShowHideColumns; 175 198 protected System.Windows.Forms.DataGridView dataGridView; 199 private System.Windows.Forms.StatusStrip statusStrip; 200 private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel; 176 201 177 202 } -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs
r4707 r4709 56 56 get { return showRowsAndColumnsTextBox; } 57 57 set { 58 if (value != showRowsAndColumnsTextBox) { 59 showRowsAndColumnsTextBox = value; 60 UpdateVisibilityOfTextBoxes(); 61 } 58 showRowsAndColumnsTextBox = value; 59 UpdateVisibilityOfTextBoxes(); 60 } 61 } 62 63 private bool showStatisticalInformation; 64 public bool ShowStatisticalInformation { 65 get { return showStatisticalInformation; } 66 set { 67 showStatisticalInformation = value; 68 UpdateVisibilityOfStatisticalInformation(); 62 69 } 63 70 } … … 65 72 public StringConvertibleMatrixView() { 66 73 InitializeComponent(); 67 showRowsAndColumnsTextBox = true; 74 ShowRowsAndColumnsTextBox = true; 75 ShowStatisticalInformation = false; 68 76 errorProvider.SetIconAlignment(rowsTextBox, ErrorIconAlignment.MiddleLeft); 69 77 errorProvider.SetIconPadding(rowsTextBox, 2); … … 496 504 rowsTextBox.Visible = columnsTextBox.Visible = showRowsAndColumnsTextBox; 497 505 rowsLabel.Visible = columnsLabel.Visible = showRowsAndColumnsTextBox; 498 506 UpdateDataGridViewSizeAndLocation(); 507 } 508 509 private void UpdateVisibilityOfStatisticalInformation() { 510 statusStrip.Visible = showStatisticalInformation; 511 UpdateDataGridViewSizeAndLocation(); 512 } 513 514 private void UpdateDataGridViewSizeAndLocation() { 499 515 int headerSize = columnsTextBox.Location.Y + columnsTextBox.Size.Height + 500 516 columnsTextBox.Margin.Bottom + dataGridView.Margin.Top; 501 517 502 518 int offset = showRowsAndColumnsTextBox ? headerSize : 0; 503 519 dataGridView.Location = new Point(0, offset); 504 dataGridView.Size = new Size(Size.Width, Size.Height - offset); 520 521 int statusStripHeight = showStatisticalInformation ? statusStrip.Height : 0; 522 dataGridView.Size = new Size(Size.Width, Size.Height - offset - statusStripHeight); 523 } 524 525 private void dataGridView_SelectionChanged(object sender, EventArgs e) { 526 toolStripStatusLabel.Text = string.Empty; 527 if (dataGridView.SelectedCells.Count > 1) { 528 List<double> selectedValues = new List<double>(); 529 foreach (DataGridViewCell cell in dataGridView.SelectedCells) { 530 double value; 531 if (!double.TryParse(cell.Value.ToString(), out value)) return; 532 selectedValues.Add(value); 533 } 534 if (selectedValues.Count > 1) { 535 StringBuilder labelText = new StringBuilder(); 536 labelText.Append("Average: " + selectedValues.Average() + " "); 537 labelText.Append("StdDev: " + selectedValues.StandardDeviation() + " "); 538 labelText.Append("Sum: " + selectedValues.Sum() + " "); 539 labelText.Append("Count: " + selectedValues.Count + " "); 540 toolStripStatusLabel.Text = labelText.ToString(); 541 } 542 } 505 543 } 506 544 }
Note: See TracChangeset
for help on using the changeset viewer.