Better mouse over performance

This commit is contained in:
Jens True 2021-06-12 19:01:41 +02:00
parent c797cc5754
commit d099322b66
3 changed files with 24 additions and 23 deletions

@ -86,7 +86,7 @@
this.labelProductName.Name = "labelProductName";
this.labelProductName.Size = new System.Drawing.Size(271, 17);
this.labelProductName.TabIndex = 19;
this.labelProductName.Text = "Tidstagning - Lemvig Sejlklub";
this.labelProductName.Text = "Tidstagning";
this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// labelVersion
@ -137,7 +137,7 @@
this.textBoxDescription.Size = new System.Drawing.Size(271, 126);
this.textBoxDescription.TabIndex = 23;
this.textBoxDescription.TabStop = false;
this.textBoxDescription.Text = "Kontakt jens.chr.true@gmail.com";
this.textBoxDescription.Text = "Kontakt jens.chr.true@gmail.com\r\nhttps://jcktrue.dk";
//
// okButton
//

@ -29,7 +29,6 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.btnTest = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
@ -179,14 +178,15 @@
this.grid.Name = "grid";
this.grid.ReadOnly = true;
this.grid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F);
this.grid.RowsDefaultCellStyle = dataGridViewCellStyle1;
this.txtLog.SetRowSpan(this.grid, 2);
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.ReadOnly = true;
this.grid.Size = new System.Drawing.Size(1039, 542);
this.grid.TabIndex = 0;
this.grid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_Click);
this.grid.MouseMove += new System.Windows.Forms.MouseEventHandler(this.grid_MouseMove);
this.grid.CellMouseEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellMouseEnter);
this.grid.CellMouseLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellMouseLeave);
//
// Complete
//

@ -131,23 +131,6 @@ namespace Tidstagning
startprocedure.Clear();
}
private void grid_MouseMove(object sender, MouseEventArgs e)
{
DataGridView.HitTestInfo hti = grid.HitTest(e.X, e.Y);
if (hti.RowIndex >= 0 && hti.RowIndex != OldRow)
{
if (grid.Rows.Count > OldRow)
{
grid.Rows[OldRow].Selected = false;
grid.Rows[OldRow].Height = 30;
}
grid.Rows[hti.RowIndex].Selected = true;
grid.Rows[hti.RowIndex].Height = 60;
OldRow = hti.RowIndex;
}
}
private void button1_Click(object sender, EventArgs e)
{
AboutBox aboutbox = new AboutBox();
@ -196,5 +179,23 @@ namespace Tidstagning
Properties.Settings.Default.AutoStartProcedure = checkStartProcedure.Checked;
Properties.Settings.Default.Save();
}
private void grid_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > -1)
{
grid.Rows[e.RowIndex].Selected = true;
grid.Rows[e.RowIndex].Height = 60;
}
}
private void grid_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > -1)
{
grid.Rows[e.RowIndex].Selected = false;
grid.Rows[e.RowIndex].Height = 30;
}
}
}
}