diff --git a/v2rayN/v2rayN/Base/ListViewFlickerFree.cs b/v2rayN/v2rayN/Base/ListViewFlickerFree.cs index 6785959b..5004e84a 100644 --- a/v2rayN/v2rayN/Base/ListViewFlickerFree.cs +++ b/v2rayN/v2rayN/Base/ListViewFlickerFree.cs @@ -18,24 +18,23 @@ namespace v2rayN.Base { try { - int count = this.Columns.Count; int MaxWidth = 0; Graphics graphics = this.CreateGraphics(); - Font font = this.Font; - ListViewItemCollection items = this.Items; string str; int width; this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); - for (int i = 0; i < count; i++) + for (int i = 0; i < this.Columns.Count; i++) { - str = this.Columns[i].Text; - MaxWidth = this.Columns[i].Width; + ColumnHeader c = this.Columns[i]; + str = c.Text; + MaxWidth = c.Width; - foreach (ListViewItem item in items) + foreach (ListViewItem item in this.Items) { + Font font = item.SubItems[i].Font; str = item.SubItems[i].Text; width = (int)graphics.MeasureString(str, font).Width; if (width > MaxWidth) @@ -43,11 +42,7 @@ namespace v2rayN.Base MaxWidth = width; } } - if (i == 0) - { - this.Columns[i].Width = MaxWidth; - } - this.Columns[i].Width = MaxWidth; + c.Width = MaxWidth; } } catch { }