mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-08 21:36:03 -05:00
Autosize dropdown width for met locations
BDSP locations are pretty long.
This commit is contained in:
@@ -1541,7 +1541,6 @@ private void InitializeComponent()
|
||||
//
|
||||
this.CB_EggLocation.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
|
||||
this.CB_EggLocation.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||
this.CB_EggLocation.DropDownWidth = 150;
|
||||
this.CB_EggLocation.FormattingEnabled = true;
|
||||
this.CB_EggLocation.Location = new System.Drawing.Point(71, 19);
|
||||
this.CB_EggLocation.Name = "CB_EggLocation";
|
||||
@@ -1687,7 +1686,6 @@ private void InitializeComponent()
|
||||
this.CB_MetLocation.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
|
||||
this.CB_MetLocation.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||
this.CB_MetLocation.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.CB_MetLocation.DropDownWidth = 200;
|
||||
this.CB_MetLocation.FormattingEnabled = true;
|
||||
this.CB_MetLocation.Location = new System.Drawing.Point(98, 0);
|
||||
this.CB_MetLocation.Margin = new System.Windows.Forms.Padding(0);
|
||||
|
||||
@@ -1242,9 +1242,15 @@ private void ReloadMetLocations(GameVersion version, int format)
|
||||
{
|
||||
var metList = GameInfo.GetLocationList(version, format, egg: false);
|
||||
CB_MetLocation.DataSource = new BindingSource(metList, null);
|
||||
CB_MetLocation.DropDownWidth = GetWidth(metList, CB_MetLocation.Font);
|
||||
|
||||
var eggList = GameInfo.GetLocationList(version, format, egg: true);
|
||||
CB_EggLocation.DataSource = new BindingSource(eggList, null);
|
||||
CB_EggLocation.DropDownWidth = GetWidth(eggList, CB_EggLocation.Font);
|
||||
|
||||
int GetWidth(IEnumerable<ComboItem> items, Font f) =>
|
||||
items.Max(z => TextRenderer.MeasureText(z.Text, f).Width) +
|
||||
SystemInformation.VerticalScrollBarWidth;
|
||||
|
||||
if (FieldsLoaded)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user