работа над формой

This commit is contained in:
Полина Чубыкина 2024-02-27 15:14:49 +04:00
parent 54775f3000
commit 6706d82142
2 changed files with 129 additions and 8 deletions

View File

@ -31,19 +31,29 @@
this.textBoxName = new System.Windows.Forms.TextBox();
this.textBoxPrice = new System.Windows.Forms.TextBox();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.groupBox = new System.Windows.Forms.GroupBox();
this.ButtonRef = new System.Windows.Forms.Button();
this.ButtonDel = new System.Windows.Forms.Button();
this.ButtonUpd = new System.Windows.Forms.Button();
this.ButtonAdd = new System.Windows.Forms.Button();
this.ButtonSave = new System.Windows.Forms.Button();
this.ButtonCancel = new System.Windows.Forms.Button();
this.labelName = new System.Windows.Forms.Label();
this.labelPrice = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.groupBox.SuspendLayout();
this.SuspendLayout();
//
// textBoxName
//
this.textBoxName.Location = new System.Drawing.Point(281, 12);
this.textBoxName.Location = new System.Drawing.Point(204, 16);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(125, 27);
this.textBoxName.Size = new System.Drawing.Size(223, 27);
this.textBoxName.TabIndex = 0;
//
// textBoxPrice
//
this.textBoxPrice.Location = new System.Drawing.Point(281, 62);
this.textBoxPrice.Location = new System.Drawing.Point(204, 64);
this.textBoxPrice.Name = "textBoxPrice";
this.textBoxPrice.Size = new System.Drawing.Size(125, 27);
this.textBoxPrice.TabIndex = 1;
@ -51,24 +61,121 @@
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(12, 250);
this.dataGridView.Location = new System.Drawing.Point(6, 26);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 51;
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(300, 188);
this.dataGridView.Size = new System.Drawing.Size(422, 297);
this.dataGridView.TabIndex = 2;
//
// groupBox
//
this.groupBox.Controls.Add(this.ButtonRef);
this.groupBox.Controls.Add(this.ButtonDel);
this.groupBox.Controls.Add(this.ButtonUpd);
this.groupBox.Controls.Add(this.ButtonAdd);
this.groupBox.Controls.Add(this.dataGridView);
this.groupBox.Location = new System.Drawing.Point(12, 109);
this.groupBox.Name = "groupBox";
this.groupBox.Size = new System.Drawing.Size(619, 329);
this.groupBox.TabIndex = 3;
this.groupBox.TabStop = false;
this.groupBox.Text = "Компоненты";
//
// ButtonRef
//
this.ButtonRef.Location = new System.Drawing.Point(477, 251);
this.ButtonRef.Name = "ButtonRef";
this.ButtonRef.Size = new System.Drawing.Size(94, 29);
this.ButtonRef.TabIndex = 6;
this.ButtonRef.Text = "Обновить";
this.ButtonRef.UseVisualStyleBackColor = true;
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
// ButtonDel
//
this.ButtonDel.Location = new System.Drawing.Point(477, 184);
this.ButtonDel.Name = "ButtonDel";
this.ButtonDel.Size = new System.Drawing.Size(94, 29);
this.ButtonDel.TabIndex = 5;
this.ButtonDel.Text = "Удалить";
this.ButtonDel.UseVisualStyleBackColor = true;
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
//
// ButtonUpd
//
this.ButtonUpd.Location = new System.Drawing.Point(477, 118);
this.ButtonUpd.Name = "ButtonUpd";
this.ButtonUpd.Size = new System.Drawing.Size(94, 29);
this.ButtonUpd.TabIndex = 4;
this.ButtonUpd.Text = "Изменить";
this.ButtonUpd.UseVisualStyleBackColor = true;
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
//
// ButtonAdd
//
this.ButtonAdd.Location = new System.Drawing.Point(477, 53);
this.ButtonAdd.Name = "ButtonAdd";
this.ButtonAdd.Size = new System.Drawing.Size(94, 29);
this.ButtonAdd.TabIndex = 3;
this.ButtonAdd.Text = "Добавить";
this.ButtonAdd.UseVisualStyleBackColor = true;
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(235, 459);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(94, 29);
this.ButtonSave.TabIndex = 7;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(433, 459);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(94, 29);
this.ButtonCancel.TabIndex = 8;
this.ButtonCancel.Text = "Удалить";
this.ButtonCancel.UseVisualStyleBackColor = true;
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// labelName
//
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(82, 19);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(80, 20);
this.labelName.TabIndex = 9;
this.labelName.Text = "Название:";
//
// labelPrice
//
this.labelPrice.AutoSize = true;
this.labelPrice.Location = new System.Drawing.Point(82, 67);
this.labelPrice.Name = "labelPrice";
this.labelPrice.Size = new System.Drawing.Size(86, 20);
this.labelPrice.TabIndex = 10;
this.labelPrice.Text = "Стоимость:";
//
// FormPastry
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1025, 450);
this.Controls.Add(this.dataGridView);
this.ClientSize = new System.Drawing.Size(643, 511);
this.Controls.Add(this.labelPrice);
this.Controls.Add(this.labelName);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.groupBox);
this.Controls.Add(this.textBoxPrice);
this.Controls.Add(this.textBoxName);
this.Name = "FormPastry";
this.Text = "FormPastry";
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.groupBox.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -79,5 +186,14 @@
private TextBox textBoxName;
private TextBox textBoxPrice;
private DataGridView dataGridView;
private GroupBox groupBox;
private Button ButtonRef;
private Button ButtonDel;
private Button ButtonUpd;
private Button ButtonAdd;
private Button ButtonSave;
private Button ButtonCancel;
private Label labelName;
private Label labelPrice;
}
}

View File

@ -31,7 +31,7 @@ namespace ConfectioneryView
_pastryComponents = new Dictionary<int, (IComponentModel, int)>();
}
private void FormProduct_Load(object sender, EventArgs e)
private void FormPastry_Load(object sender, EventArgs e)
{
if (_id.HasValue)
{
@ -137,6 +137,11 @@ namespace ConfectioneryView
}
}
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)