feat: keybinds

This commit is contained in:
Frozd
2025-11-28 13:08:18 +01:00
parent bb71806a22
commit d17e1183f9
2 changed files with 27 additions and 8 deletions

View File

@@ -118,7 +118,7 @@
this.tbxMake.Location = new System.Drawing.Point(68, 203); this.tbxMake.Location = new System.Drawing.Point(68, 203);
this.tbxMake.Name = "tbxMake"; this.tbxMake.Name = "tbxMake";
this.tbxMake.Size = new System.Drawing.Size(473, 22); this.tbxMake.Size = new System.Drawing.Size(473, 22);
this.tbxMake.TabIndex = 2; this.tbxMake.TabIndex = 1;
this.tbxMake.TextChanged += new System.EventHandler(this.tbxMake_TextChanged); this.tbxMake.TextChanged += new System.EventHandler(this.tbxMake_TextChanged);
// //
// label2 // label2
@@ -136,7 +136,7 @@
this.tbxModel.Location = new System.Drawing.Point(68, 233); this.tbxModel.Location = new System.Drawing.Point(68, 233);
this.tbxModel.Name = "tbxModel"; this.tbxModel.Name = "tbxModel";
this.tbxModel.Size = new System.Drawing.Size(473, 22); this.tbxModel.Size = new System.Drawing.Size(473, 22);
this.tbxModel.TabIndex = 4; this.tbxModel.TabIndex = 2;
this.tbxModel.TextChanged += new System.EventHandler(this.tbxModel_TextChanged); this.tbxModel.TextChanged += new System.EventHandler(this.tbxModel_TextChanged);
// //
// label3 // label3
@@ -194,7 +194,7 @@
this.btnSave.Location = new System.Drawing.Point(450, 8); this.btnSave.Location = new System.Drawing.Point(450, 8);
this.btnSave.Name = "btnSave"; this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23); this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 0; this.btnSave.TabIndex = 7;
this.btnSave.Text = "Save"; this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = true; this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click); this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
@@ -204,7 +204,7 @@
this.btnDelete.Location = new System.Drawing.Point(369, 8); this.btnDelete.Location = new System.Drawing.Point(369, 8);
this.btnDelete.Name = "btnDelete"; this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(75, 23); this.btnDelete.Size = new System.Drawing.Size(75, 23);
this.btnDelete.TabIndex = 1; this.btnDelete.TabIndex = 8;
this.btnDelete.Text = "Delete"; this.btnDelete.Text = "Delete";
this.btnDelete.UseVisualStyleBackColor = true; this.btnDelete.UseVisualStyleBackColor = true;
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click); this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
@@ -228,7 +228,7 @@
0}); 0});
this.nudYear.Name = "nudYear"; this.nudYear.Name = "nudYear";
this.nudYear.Size = new System.Drawing.Size(120, 22); this.nudYear.Size = new System.Drawing.Size(120, 22);
this.nudYear.TabIndex = 10; this.nudYear.TabIndex = 3;
this.nudYear.ValueChanged += new System.EventHandler(this.nudYear_ValueChanged); this.nudYear.ValueChanged += new System.EventHandler(this.nudYear_ValueChanged);
// //
// tbxColor // tbxColor
@@ -237,7 +237,7 @@
this.tbxColor.Location = new System.Drawing.Point(68, 293); this.tbxColor.Location = new System.Drawing.Point(68, 293);
this.tbxColor.Name = "tbxColor"; this.tbxColor.Name = "tbxColor";
this.tbxColor.Size = new System.Drawing.Size(473, 22); this.tbxColor.Size = new System.Drawing.Size(473, 22);
this.tbxColor.TabIndex = 11; this.tbxColor.TabIndex = 4;
this.tbxColor.TextChanged += new System.EventHandler(this.tbxColor_TextChanged); this.tbxColor.TextChanged += new System.EventHandler(this.tbxColor_TextChanged);
// //
// nudMileage // nudMileage
@@ -250,7 +250,7 @@
0}); 0});
this.nudMileage.Name = "nudMileage"; this.nudMileage.Name = "nudMileage";
this.nudMileage.Size = new System.Drawing.Size(120, 22); this.nudMileage.Size = new System.Drawing.Size(120, 22);
this.nudMileage.TabIndex = 12; this.nudMileage.TabIndex = 5;
this.nudMileage.ThousandsSeparator = true; this.nudMileage.ThousandsSeparator = true;
this.nudMileage.ValueChanged += new System.EventHandler(this.nudMileage_ValueChanged); this.nudMileage.ValueChanged += new System.EventHandler(this.nudMileage_ValueChanged);
// //
@@ -265,7 +265,7 @@
0}); 0});
this.nudPrice.Name = "nudPrice"; this.nudPrice.Name = "nudPrice";
this.nudPrice.Size = new System.Drawing.Size(120, 22); this.nudPrice.Size = new System.Drawing.Size(120, 22);
this.nudPrice.TabIndex = 13; this.nudPrice.TabIndex = 6;
this.nudPrice.ThousandsSeparator = true; this.nudPrice.ThousandsSeparator = true;
this.nudPrice.ValueChanged += new System.EventHandler(this.nudPrice_ValueChanged); this.nudPrice.ValueChanged += new System.EventHandler(this.nudPrice_ValueChanged);
// //

View File

@@ -94,5 +94,24 @@ namespace CarManagerV2
} }
} }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Enter)
{
btnSave.PerformClick();
return true; // Indicate that the key has been handled
}
if (keyData == Keys.Escape)
{
this.Close();
return true; // Indicate that the key has been handled
}
if (keyData == Keys.Delete)
{
btnDelete.PerformClick();
return true; // Indicate that the key has been handled
}
return base.ProcessCmdKey(ref msg, keyData);
}
} }
} }