Skip to content

Commit

Permalink
Fix height issue of nav list items on high dpi
Browse files Browse the repository at this point in the history
  • Loading branch information
jie65535 committed Sep 7, 2024
1 parent b37016a commit fafff80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions Source/GrasscutterTools/Forms/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions Source/GrasscutterTools/Forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,6 @@ private void ShowPage(BasePage page)
/// <summary>
/// 导航列表项居中绘制
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ListPages_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
Expand All @@ -413,6 +411,15 @@ private void ListPages_DrawItem(object sender, DrawItemEventArgs e)
e.Graphics.DrawString(ListPages.Items[e.Index].ToString(), e.Font, new SolidBrush(e.ForeColor), e.Bounds, strFmt);
}

/// <summary>
/// 导航列表高度测量
/// </summary>
private void ListPages_MeasureItem(object sender, MeasureItemEventArgs e)
{
// 列表项高度为字体高度1.5倍
e.ItemHeight = ListPages.Font.Height * 3 / 2;
}

/// <summary>
/// 导航列表大小改变时触发
/// </summary>
Expand Down

0 comments on commit fafff80

Please sign in to comment.