Focus on mouseover so spacebar may be used for pressing complete
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jens True 2021-06-12 19:42:33 +02:00
parent d099322b66
commit 4a8b7bf3b7
2 changed files with 29 additions and 7 deletions

@ -164,8 +164,11 @@
// //
this.grid.AllowUserToAddRows = false; this.grid.AllowUserToAddRows = false;
this.grid.AllowUserToDeleteRows = false; this.grid.AllowUserToDeleteRows = false;
this.grid.AllowUserToResizeColumns = false;
this.grid.AllowUserToResizeRows = false;
this.grid.AutoGenerateColumns = false; this.grid.AutoGenerateColumns = false;
this.grid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.grid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.grid.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable;
this.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Complete, this.Complete,
@ -174,7 +177,9 @@
this.txtLog.SetColumnSpan(this.grid, 2); this.txtLog.SetColumnSpan(this.grid, 2);
this.grid.DataSource = this.entryBindingSource; this.grid.DataSource = this.entryBindingSource;
this.grid.Dock = System.Windows.Forms.DockStyle.Fill; this.grid.Dock = System.Windows.Forms.DockStyle.Fill;
this.grid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.grid.Location = new System.Drawing.Point(273, 3); this.grid.Location = new System.Drawing.Point(273, 3);
this.grid.MultiSelect = false;
this.grid.Name = "grid"; this.grid.Name = "grid";
this.grid.ReadOnly = true; this.grid.ReadOnly = true;
this.grid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; this.grid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
@ -182,6 +187,7 @@
this.grid.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.grid.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grid.RowTemplate.Height = 30; this.grid.RowTemplate.Height = 30;
this.grid.RowTemplate.ReadOnly = true; this.grid.RowTemplate.ReadOnly = true;
this.grid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.grid.Size = new System.Drawing.Size(1039, 542); this.grid.Size = new System.Drawing.Size(1039, 542);
this.grid.TabIndex = 0; this.grid.TabIndex = 0;
this.grid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_Click); this.grid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_Click);
@ -315,6 +321,7 @@
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(1315, 694); this.ClientSize = new System.Drawing.Size(1315, 694);
this.Controls.Add(this.txtLog); this.Controls.Add(this.txtLog);
this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1"; this.Name = "Form1";
this.Text = "Tidstagning"; this.Text = "Tidstagning";

@ -14,7 +14,6 @@ namespace Tidstagning
Relay horn; Relay horn;
Procedure startprocedure = new Procedure(); Procedure startprocedure = new Procedure();
int OldRow = 0;
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
@ -182,20 +181,36 @@ namespace Tidstagning
private void grid_CellMouseEnter(object sender, DataGridViewCellEventArgs e) private void grid_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{ {
if (e.RowIndex > -1) if (e.RowIndex > -1 )
{
try
{ {
grid.Rows[e.RowIndex].Selected = true; grid.Rows[e.RowIndex].Selected = true;
grid.Rows[e.RowIndex].Height = 60; grid.Rows[e.RowIndex].Height = 60;
grid.CurrentCell = grid.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (btnStop.Enabled)
{
grid.Focus();
}
}
catch { }
} }
} }
private void grid_CellMouseLeave(object sender, DataGridViewCellEventArgs e) private void grid_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{ {
if (e.RowIndex > -1) if (e.RowIndex > -1 )
{
try
{ {
grid.Rows[e.RowIndex].Selected = false; grid.Rows[e.RowIndex].Selected = false;
grid.Rows[e.RowIndex].Height = 30; grid.Rows[e.RowIndex].Height = 30;
} }
catch
{ }
}
} }
} }
} }