Disable save and run buttons when items are empty

This commit is contained in:
aj
2018-06-02 20:22:14 -04:00
parent 4277b866af
commit 2d0494731d
3 changed files with 236 additions and 209 deletions

View File

@@ -29,10 +29,15 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.quantityDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.TotalLength = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.itemBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
@@ -40,26 +45,21 @@
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.saveButton = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.TotalLength = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.quantityDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.itemBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.runButton = new System.Windows.Forms.ToolStripButton();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.itemBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.itemBindingSource)).BeginInit();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.AllowUserToResizeRows = false;
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.AutoGenerateColumns = false;
this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
@@ -82,6 +82,46 @@
this.dataGridView1.Size = new System.Drawing.Size(763, 361);
this.dataGridView1.TabIndex = 5;
//
// nameDataGridViewTextBoxColumn
//
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
this.nameDataGridViewTextBoxColumn.Width = 200;
//
// lengthDataGridViewTextBoxColumn
//
this.lengthDataGridViewTextBoxColumn.DataPropertyName = "Length";
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.lengthDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle4;
this.lengthDataGridViewTextBoxColumn.HeaderText = "Length";
this.lengthDataGridViewTextBoxColumn.Name = "lengthDataGridViewTextBoxColumn";
this.lengthDataGridViewTextBoxColumn.Width = 120;
//
// quantityDataGridViewTextBoxColumn
//
this.quantityDataGridViewTextBoxColumn.DataPropertyName = "Quantity";
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.quantityDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle5;
this.quantityDataGridViewTextBoxColumn.HeaderText = "Qty";
this.quantityDataGridViewTextBoxColumn.Name = "quantityDataGridViewTextBoxColumn";
this.quantityDataGridViewTextBoxColumn.Width = 50;
//
// TotalLength
//
this.TotalLength.DataPropertyName = "TotalLength";
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Info;
dataGridViewCellStyle6.Format = "N3";
this.TotalLength.DefaultCellStyle = dataGridViewCellStyle6;
this.TotalLength.HeaderText = "Total Length";
this.TotalLength.Name = "TotalLength";
this.TotalLength.ReadOnly = true;
//
// itemBindingSource
//
this.itemBindingSource.DataSource = typeof(CutToLength.UIItem);
//
// label1
//
this.label1.AutoSize = true;
@@ -154,9 +194,9 @@
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton1,
this.toolStripButton2,
this.saveButton,
this.toolStripSeparator1,
this.toolStripButton3});
this.runButton});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(787, 39);
@@ -175,76 +215,36 @@
this.toolStripButton1.Text = "Open";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
//
// toolStripButton2
// saveButton
//
this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton2.Image = global::CutToLength.Properties.Resources.Save_32;
this.toolStripButton2.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton2.Name = "toolStripButton2";
this.toolStripButton2.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.toolStripButton2.Size = new System.Drawing.Size(46, 36);
this.toolStripButton2.Text = "Save";
this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click);
this.saveButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.saveButton.Image = global::CutToLength.Properties.Resources.Save_32;
this.saveButton.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.saveButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.saveButton.Name = "saveButton";
this.saveButton.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.saveButton.Size = new System.Drawing.Size(46, 36);
this.saveButton.Text = "Save";
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 39);
//
// toolStripButton3
// runButton
//
this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton3.Image = global::CutToLength.Properties.Resources.Circled_Play_32;
this.toolStripButton3.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton3.Name = "toolStripButton3";
this.toolStripButton3.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.toolStripButton3.Size = new System.Drawing.Size(46, 36);
this.toolStripButton3.Text = "Run";
this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click);
this.runButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.runButton.Image = global::CutToLength.Properties.Resources.Circled_Play_32;
this.runButton.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.runButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.runButton.Name = "runButton";
this.runButton.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.runButton.Size = new System.Drawing.Size(46, 36);
this.runButton.Text = "Run";
this.runButton.Click += new System.EventHandler(this.runButton_Click);
//
// TotalLength
//
this.TotalLength.DataPropertyName = "TotalLength";
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Info;
dataGridViewCellStyle3.Format = "N3";
this.TotalLength.DefaultCellStyle = dataGridViewCellStyle3;
this.TotalLength.HeaderText = "Total Length";
this.TotalLength.Name = "TotalLength";
this.TotalLength.ReadOnly = true;
//
// nameDataGridViewTextBoxColumn
//
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
this.nameDataGridViewTextBoxColumn.Width = 200;
//
// lengthDataGridViewTextBoxColumn
//
this.lengthDataGridViewTextBoxColumn.DataPropertyName = "Length";
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.lengthDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1;
this.lengthDataGridViewTextBoxColumn.HeaderText = "Length";
this.lengthDataGridViewTextBoxColumn.Name = "lengthDataGridViewTextBoxColumn";
this.lengthDataGridViewTextBoxColumn.Width = 120;
//
// quantityDataGridViewTextBoxColumn
//
this.quantityDataGridViewTextBoxColumn.DataPropertyName = "Quantity";
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.quantityDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
this.quantityDataGridViewTextBoxColumn.HeaderText = "Qty";
this.quantityDataGridViewTextBoxColumn.Name = "quantityDataGridViewTextBoxColumn";
this.quantityDataGridViewTextBoxColumn.Width = 50;
//
// itemBindingSource
//
this.itemBindingSource.DataSource = typeof(CutToLength.UIItem);
//
// Form1
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(787, 496);
@@ -258,15 +258,15 @@
this.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MinimumSize = new System.Drawing.Size(570, 457);
this.Name = "Form1";
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Cut To Length";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.itemBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.itemBindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -282,8 +282,8 @@
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.ToolStripButton toolStripButton2;
private System.Windows.Forms.ToolStripButton toolStripButton3;
private System.Windows.Forms.ToolStripButton saveButton;
private System.Windows.Forms.ToolStripButton runButton;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn lengthDataGridViewTextBoxColumn;