Compare commits

...

2 Commits

Author SHA1 Message Date
剧毒的KCN
e6a2d26671
Fix ListBox overflow on high DPI (#235) 2024-09-07 21:35:50 +08:00
fafff8090f Fix height issue of nav list items on high dpi 2024-09-07 20:44:23 +08:00
17 changed files with 62 additions and 12 deletions

View File

@ -63,6 +63,7 @@ namespace GrasscutterTools.Forms
this.ListPages.FormattingEnabled = true; this.ListPages.FormattingEnabled = true;
this.ListPages.Name = "ListPages"; this.ListPages.Name = "ListPages";
this.ListPages.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ListPages_DrawItem); this.ListPages.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ListPages_DrawItem);
this.ListPages.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.ListPages_MeasureItem);
this.ListPages.SelectedIndexChanged += new System.EventHandler(this.ListPages_SelectedIndexChanged); this.ListPages.SelectedIndexChanged += new System.EventHandler(this.ListPages_SelectedIndexChanged);
this.ListPages.SizeChanged += new System.EventHandler(this.ListPages_SizeChanged); this.ListPages.SizeChanged += new System.EventHandler(this.ListPages_SizeChanged);
// //
@ -116,6 +117,7 @@ namespace GrasscutterTools.Forms
// //
// MenuSpawnEntityFilter // MenuSpawnEntityFilter
// //
this.MenuSpawnEntityFilter.ImageScalingSize = new System.Drawing.Size(24, 24);
this.MenuSpawnEntityFilter.Name = "MenuSpawnEntityFilter"; this.MenuSpawnEntityFilter.Name = "MenuSpawnEntityFilter";
resources.ApplyResources(this.MenuSpawnEntityFilter, "MenuSpawnEntityFilter"); resources.ApplyResources(this.MenuSpawnEntityFilter, "MenuSpawnEntityFilter");
// //

View File

@ -399,8 +399,6 @@ namespace GrasscutterTools.Forms
/// <summary> /// <summary>
/// 导航列表项居中绘制 /// 导航列表项居中绘制
/// </summary> /// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ListPages_DrawItem(object sender, DrawItemEventArgs e) private void ListPages_DrawItem(object sender, DrawItemEventArgs e)
{ {
e.DrawBackground(); e.DrawBackground();
@ -413,6 +411,15 @@ namespace GrasscutterTools.Forms
e.Graphics.DrawString(ListPages.Items[e.Index].ToString(), e.Font, new SolidBrush(e.ForeColor), e.Bounds, strFmt); 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>
/// 导航列表大小改变时触发 /// 导航列表大小改变时触发
/// </summary> /// </summary>

View File

@ -51,6 +51,7 @@
this.ListAchievements.FormattingEnabled = true; this.ListAchievements.FormattingEnabled = true;
this.ListAchievements.Name = "ListAchievements"; this.ListAchievements.Name = "ListAchievements";
this.ListAchievements.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; this.ListAchievements.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.ListAchievements.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.ListAchievements_MeasureItem);
// //
// GrpAchievements // GrpAchievements
// //

View File

@ -110,5 +110,9 @@ namespace GrasscutterTools.Pages
GenSelected("/achievement progress", NUDProgress.Text); GenSelected("/achievement progress", NUDProgress.Text);
} }
private void ListAchievements_MeasureItem(object sender, MeasureItemEventArgs e)
{
e.ItemHeight = ListAchievements.Font.Height * 3 / 2;
}
} }
} }

View File

@ -154,6 +154,7 @@
resources.ApplyResources(this.ListSubAttributionChecked, "ListSubAttributionChecked"); resources.ApplyResources(this.ListSubAttributionChecked, "ListSubAttributionChecked");
this.ListSubAttributionChecked.FormattingEnabled = true; this.ListSubAttributionChecked.FormattingEnabled = true;
this.ListSubAttributionChecked.Name = "ListSubAttributionChecked"; this.ListSubAttributionChecked.Name = "ListSubAttributionChecked";
this.ListSubAttributionChecked.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.ListSubAttributionChecked_MeasureItem);
this.ListSubAttributionChecked.SelectedIndexChanged += new System.EventHandler(this.ListSubAttributionChecked_SelectedIndexChanged); this.ListSubAttributionChecked.SelectedIndexChanged += new System.EventHandler(this.ListSubAttributionChecked_SelectedIndexChanged);
// //
// LblArtifactLevel // LblArtifactLevel

View File

@ -265,5 +265,10 @@ namespace GrasscutterTools.Pages
{ {
UIUtil.OpenURL("https://github.com/Penelopeep/CharacterBuilder"); UIUtil.OpenURL("https://github.com/Penelopeep/CharacterBuilder");
} }
private void ListSubAttributionChecked_MeasureItem(object sender, MeasureItemEventArgs e)
{
e.ItemHeight = ListSubAttributionChecked.Font.Height * 3 / 2;
}
} }
} }

View File

@ -104,6 +104,7 @@
resources.ApplyResources(this.ListGameItems, "ListGameItems"); resources.ApplyResources(this.ListGameItems, "ListGameItems");
this.ListGameItems.FormattingEnabled = true; this.ListGameItems.FormattingEnabled = true;
this.ListGameItems.Name = "ListGameItems"; this.ListGameItems.Name = "ListGameItems";
this.ListGameItems.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.ListGameItems_MeasureItem);
this.ListGameItems.SelectedIndexChanged += new System.EventHandler(this.GiveItemsInputChanged); this.ListGameItems.SelectedIndexChanged += new System.EventHandler(this.GiveItemsInputChanged);
// //
// LblGameItemAmount // LblGameItemAmount
@ -172,6 +173,7 @@
// //
// MenuItemFilter // MenuItemFilter
// //
this.MenuItemFilter.ImageScalingSize = new System.Drawing.Size(24, 24);
this.MenuItemFilter.Name = "MenuSpawnEntityFilter"; this.MenuItemFilter.Name = "MenuSpawnEntityFilter";
resources.ApplyResources(this.MenuItemFilter, "MenuItemFilter"); resources.ApplyResources(this.MenuItemFilter, "MenuItemFilter");
// //

View File

@ -250,5 +250,9 @@ namespace GrasscutterTools.Pages
#endregion -- -- #endregion -- --
private void ListGameItems_MeasureItem(object sender, MeasureItemEventArgs e)
{
e.ItemHeight = ListGameItems.Font.Height * 3 / 2;
}
} }
} }

View File

@ -141,6 +141,7 @@
resources.ApplyResources(this.ListWeapons, "ListWeapons"); resources.ApplyResources(this.ListWeapons, "ListWeapons");
this.ListWeapons.FormattingEnabled = true; this.ListWeapons.FormattingEnabled = true;
this.ListWeapons.Name = "ListWeapons"; this.ListWeapons.Name = "ListWeapons";
this.ListWeapons.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.ListWeapons_MeasureItem);
this.ListWeapons.SelectedIndexChanged += new System.EventHandler(this.WeaponValueChanged); this.ListWeapons.SelectedIndexChanged += new System.EventHandler(this.WeaponValueChanged);
// //
// LblClearFilter // LblClearFilter

View File

@ -82,5 +82,10 @@ namespace GrasscutterTools.Pages
{ {
SetCommand("/give", $"weapons x{NUDWeaponAmout.Value} lv{NUDWeaponLevel.Value} r{NUDWeaponRefinement.Value}"); SetCommand("/give", $"weapons x{NUDWeaponAmout.Value} lv{NUDWeaponLevel.Value} r{NUDWeaponRefinement.Value}");
} }
private void ListWeapons_MeasureItem(object sender, System.Windows.Forms.MeasureItemEventArgs e)
{
e.ItemHeight = ListWeapons.Font.Height * 3 / 2;
}
} }
} }

View File

@ -34,6 +34,7 @@
this.BtnDeleteMailItem = new System.Windows.Forms.Button(); this.BtnDeleteMailItem = new System.Windows.Forms.Button();
this.TCMailRight = new System.Windows.Forms.TabControl(); this.TCMailRight = new System.Windows.Forms.TabControl();
this.TPMailSelectableItemList = new System.Windows.Forms.TabPage(); this.TPMailSelectableItemList = new System.Windows.Forms.TabPage();
this.LblClearFilter = new System.Windows.Forms.Label();
this.ListMailSelectableItems = new System.Windows.Forms.ListBox(); this.ListMailSelectableItems = new System.Windows.Forms.ListBox();
this.TxtMailSelectableItemFilter = new System.Windows.Forms.TextBox(); this.TxtMailSelectableItemFilter = new System.Windows.Forms.TextBox();
this.PanelMailItemArgs = new System.Windows.Forms.Panel(); this.PanelMailItemArgs = new System.Windows.Forms.Panel();
@ -59,7 +60,6 @@
this.LblMailTitleLabel = new System.Windows.Forms.Label(); this.LblMailTitleLabel = new System.Windows.Forms.Label();
this.TxtMailSender = new System.Windows.Forms.TextBox(); this.TxtMailSender = new System.Windows.Forms.TextBox();
this.LblMailSenderLabel = new System.Windows.Forms.Label(); this.LblMailSenderLabel = new System.Windows.Forms.Label();
this.LblClearFilter = new System.Windows.Forms.Label();
this.TCMailRight.SuspendLayout(); this.TCMailRight.SuspendLayout();
this.TPMailSelectableItemList.SuspendLayout(); this.TPMailSelectableItemList.SuspendLayout();
this.PanelMailItemArgs.SuspendLayout(); this.PanelMailItemArgs.SuspendLayout();
@ -109,6 +109,14 @@
this.TPMailSelectableItemList.Name = "TPMailSelectableItemList"; this.TPMailSelectableItemList.Name = "TPMailSelectableItemList";
this.TPMailSelectableItemList.UseVisualStyleBackColor = true; this.TPMailSelectableItemList.UseVisualStyleBackColor = true;
// //
// LblClearFilter
//
resources.ApplyResources(this.LblClearFilter, "LblClearFilter");
this.LblClearFilter.BackColor = System.Drawing.Color.White;
this.LblClearFilter.Cursor = System.Windows.Forms.Cursors.Hand;
this.LblClearFilter.Name = "LblClearFilter";
this.LblClearFilter.Click += new System.EventHandler(this.LblClearFilter_Click);
//
// ListMailSelectableItems // ListMailSelectableItems
// //
resources.ApplyResources(this.ListMailSelectableItems, "ListMailSelectableItems"); resources.ApplyResources(this.ListMailSelectableItems, "ListMailSelectableItems");
@ -228,6 +236,7 @@
resources.ApplyResources(this.ListMailItems, "ListMailItems"); resources.ApplyResources(this.ListMailItems, "ListMailItems");
this.ListMailItems.FormattingEnabled = true; this.ListMailItems.FormattingEnabled = true;
this.ListMailItems.Name = "ListMailItems"; this.ListMailItems.Name = "ListMailItems";
this.ListMailItems.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.ListMailItems_MeasureItem);
// //
// LblMailItemsLabel // LblMailItemsLabel
// //
@ -298,14 +307,6 @@
resources.ApplyResources(this.LblMailSenderLabel, "LblMailSenderLabel"); resources.ApplyResources(this.LblMailSenderLabel, "LblMailSenderLabel");
this.LblMailSenderLabel.Name = "LblMailSenderLabel"; this.LblMailSenderLabel.Name = "LblMailSenderLabel";
// //
// LblClearFilter
//
resources.ApplyResources(this.LblClearFilter, "LblClearFilter");
this.LblClearFilter.BackColor = System.Drawing.Color.White;
this.LblClearFilter.Cursor = System.Windows.Forms.Cursors.Hand;
this.LblClearFilter.Name = "LblClearFilter";
this.LblClearFilter.Click += new System.EventHandler(this.LblClearFilter_Click);
//
// PageMail // PageMail
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");

View File

@ -299,5 +299,9 @@ namespace GrasscutterTools.Pages
#endregion -- Mail list -- #endregion -- Mail list --
private void ListMailItems_MeasureItem(object sender, MeasureItemEventArgs e)
{
e.ItemHeight = ListMailItems.Font.Height * 3 / 2;
}
} }
} }

View File

@ -108,6 +108,7 @@
resources.ApplyResources(this.ListQuest, "ListQuest"); resources.ApplyResources(this.ListQuest, "ListQuest");
this.ListQuest.FormattingEnabled = true; this.ListQuest.FormattingEnabled = true;
this.ListQuest.Name = "ListQuest"; this.ListQuest.Name = "ListQuest";
this.ListQuest.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.ListQuest_MeasureItem);
this.ListQuest.SelectedIndexChanged += new System.EventHandler(this.ListQuest_SelectedIndexChanged); this.ListQuest.SelectedIndexChanged += new System.EventHandler(this.ListQuest_SelectedIndexChanged);
// //
// LblClearFilter // LblClearFilter

View File

@ -98,5 +98,10 @@ namespace GrasscutterTools.Pages
var id = ItemMap.ToId(item); var id = ItemMap.ToId(item);
SetCommand($"/quest add {id} | /quest finish {id}"); SetCommand($"/quest add {id} | /quest finish {id}");
} }
private void ListQuest_MeasureItem(object sender, MeasureItemEventArgs e)
{
e.ItemHeight = ListQuest.Font.Height * 3 / 2;
}
} }
} }

View File

@ -176,6 +176,7 @@
resources.ApplyResources(this.ListScenes, "ListScenes"); resources.ApplyResources(this.ListScenes, "ListScenes");
this.ListScenes.FormattingEnabled = true; this.ListScenes.FormattingEnabled = true;
this.ListScenes.Name = "ListScenes"; this.ListScenes.Name = "ListScenes";
this.ListScenes.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.ListScenes_MeasureItem);
this.ListScenes.SelectedIndexChanged += new System.EventHandler(this.ListScenes_SelectedIndexChanged); this.ListScenes.SelectedIndexChanged += new System.EventHandler(this.ListScenes_SelectedIndexChanged);
// //
// LblTp // LblTp

View File

@ -155,5 +155,10 @@ namespace GrasscutterTools.Pages
{ {
SetCommand("/prop", "is_game_time_locked on"); SetCommand("/prop", "is_game_time_locked on");
} }
private void ListScenes_MeasureItem(object sender, System.Windows.Forms.MeasureItemEventArgs e)
{
e.ItemHeight = ListScenes.Font.Height * 3 / 2;
}
} }
} }

View File

@ -59,6 +59,7 @@ namespace GrasscutterTools.Pages
CmbGcVersions.SelectedIndexChanged += (o, e) => CommandVersion.Current = CommandVersion.List[CmbGcVersions.SelectedIndex]; CmbGcVersions.SelectedIndexChanged += (o, e) => CommandVersion.Current = CommandVersion.List[CmbGcVersions.SelectedIndex];
CommandVersion.VersionChanged += (o, e) => Settings.Default.CommandVersion = CommandVersion.Current.ToString(3); CommandVersion.VersionChanged += (o, e) => Settings.Default.CommandVersion = CommandVersion.Current.ToString(3);
ChkListPages.ItemHeight = ChkListPages.Font.Height * 3 / 2;
} }
/// <summary> /// <summary>