mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-19 21:52:25 +00:00
fix bold measuring
This commit is contained in:
parent
56a8521893
commit
5de50009d2
1 changed files with 7 additions and 12 deletions
|
@ -18,24 +18,23 @@ namespace v2rayN.Base
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int count = this.Columns.Count;
|
|
||||||
int MaxWidth = 0;
|
int MaxWidth = 0;
|
||||||
Graphics graphics = this.CreateGraphics();
|
Graphics graphics = this.CreateGraphics();
|
||||||
Font font = this.Font;
|
|
||||||
ListViewItemCollection items = this.Items;
|
|
||||||
|
|
||||||
string str;
|
string str;
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
|
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;
|
ColumnHeader c = this.Columns[i];
|
||||||
MaxWidth = this.Columns[i].Width;
|
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;
|
str = item.SubItems[i].Text;
|
||||||
width = (int)graphics.MeasureString(str, font).Width;
|
width = (int)graphics.MeasureString(str, font).Width;
|
||||||
if (width > MaxWidth)
|
if (width > MaxWidth)
|
||||||
|
@ -43,11 +42,7 @@ namespace v2rayN.Base
|
||||||
MaxWidth = width;
|
MaxWidth = width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == 0)
|
c.Width = MaxWidth;
|
||||||
{
|
|
||||||
this.Columns[i].Width = MaxWidth;
|
|
||||||
}
|
|
||||||
this.Columns[i].Width = MaxWidth;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
Loading…
Reference in a new issue