From ec467add714256714d35c91fecd2620e3667990a Mon Sep 17 00:00:00 2001 From: Jaex Date: Thu, 15 Nov 2018 16:03:59 +0300 Subject: [PATCH] Auto resize date column, fix cursor --- ShareX/Controls/NewsListControl.Designer.cs | 36 +++++++++++---------- ShareX/Controls/NewsListControl.cs | 10 ++---- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/ShareX/Controls/NewsListControl.Designer.cs b/ShareX/Controls/NewsListControl.Designer.cs index f5a5c607a..8241e206d 100644 --- a/ShareX/Controls/NewsListControl.Designer.cs +++ b/ShareX/Controls/NewsListControl.Designer.cs @@ -28,9 +28,9 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + 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(); this.dgvNews = new System.Windows.Forms.DataGridView(); this.chIsUnread = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.chDateTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -54,15 +54,15 @@ private void InitializeComponent() this.chIsUnread, this.chDateTime, this.chText}); - dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle9.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle9.Padding = new System.Windows.Forms.Padding(5); - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvNews.DefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle3.Padding = new System.Windows.Forms.Padding(5); + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvNews.DefaultCellStyle = dataGridViewCellStyle3; this.dgvNews.Dock = System.Windows.Forms.DockStyle.Fill; this.dgvNews.Location = new System.Drawing.Point(0, 0); this.dgvNews.Name = "dgvNews"; @@ -82,18 +82,20 @@ private void InitializeComponent() // // chDateTime // - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.chDateTime.DefaultCellStyle = dataGridViewCellStyle7; + this.chDateTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.chDateTime.DefaultCellStyle = dataGridViewCellStyle1; this.chDateTime.HeaderText = "DateTime"; this.chDateTime.Name = "chDateTime"; this.chDateTime.ReadOnly = true; + this.chDateTime.Width = 5; // // chText // this.chText.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - dataGridViewCellStyle8.Padding = new System.Windows.Forms.Padding(5); - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.chText.DefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(5); + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.chText.DefaultCellStyle = dataGridViewCellStyle2; this.chText.HeaderText = "Text"; this.chText.Name = "chText"; this.chText.ReadOnly = true; diff --git a/ShareX/Controls/NewsListControl.cs b/ShareX/Controls/NewsListControl.cs index 4e6037228..1a86a2179 100644 --- a/ShareX/Controls/NewsListControl.cs +++ b/ShareX/Controls/NewsListControl.cs @@ -165,10 +165,6 @@ private void dgvNews_CellMouseEnter(object sender, DataGridViewCellEventArgs e) row.Cells[e.ColumnIndex].Style.ForeColor = row.Cells[e.ColumnIndex].Style.SelectionForeColor = SystemColors.HotTrack; } } - else - { - dgvNews.Cursor = Cursors.Default; - } } private void dgvNews_CellMouseLeave(object sender, DataGridViewCellEventArgs e) @@ -182,10 +178,8 @@ private void dgvNews_CellMouseLeave(object sender, DataGridViewCellEventArgs e) row.Cells[e.ColumnIndex].Style.ForeColor = row.Cells[e.ColumnIndex].Style.SelectionForeColor = SystemColors.ControlText; } } - else - { - dgvNews.Cursor = Cursors.Default; - } + + dgvNews.Cursor = Cursors.Default; } private void dgvNews_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)