diff --git a/DoomModLoader2C/Forms/MainForm.Designer.cs b/DoomModLoader2C/Forms/MainForm.Designer.cs index d033300..7e85a02 100644 --- a/DoomModLoader2C/Forms/MainForm.Designer.cs +++ b/DoomModLoader2C/Forms/MainForm.Designer.cs @@ -199,6 +199,7 @@ private void InitializeComponent() this.cmbPreset.Name = "cmbPreset"; this.cmbPreset.Size = new System.Drawing.Size(302, 21); this.cmbPreset.TabIndex = 6; + this.cmbPreset.DropDown += new System.EventHandler(this.cmbPreset_DropDown); this.cmbPreset.SelectedIndexChanged += new System.EventHandler(this.cmbPreset_SelectedIndexChanged); // // PathBinding @@ -688,28 +689,28 @@ private void InitializeComponent() // openIWADFolderToolStripMenuItem // this.openIWADFolderToolStripMenuItem.Name = "openIWADFolderToolStripMenuItem"; - this.openIWADFolderToolStripMenuItem.Size = new System.Drawing.Size(228, 22); + this.openIWADFolderToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.openIWADFolderToolStripMenuItem.Text = "Open \"IWAD\" folder"; this.openIWADFolderToolStripMenuItem.Click += new System.EventHandler(this.openIWADFolderToolStripMenuItem_Click); // // openPWADFolderToolStripMenuItem // this.openPWADFolderToolStripMenuItem.Name = "openPWADFolderToolStripMenuItem"; - this.openPWADFolderToolStripMenuItem.Size = new System.Drawing.Size(228, 22); + this.openPWADFolderToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.openPWADFolderToolStripMenuItem.Text = "Open \"PWAD\" folder"; this.openPWADFolderToolStripMenuItem.Click += new System.EventHandler(this.openPWADFolderToolStripMenuItem_Click); // // openPORTFolderToolStripMenuItem // this.openPORTFolderToolStripMenuItem.Name = "openPORTFolderToolStripMenuItem"; - this.openPORTFolderToolStripMenuItem.Size = new System.Drawing.Size(228, 22); + this.openPORTFolderToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.openPORTFolderToolStripMenuItem.Text = "Open \"PORT\" folder"; this.openPORTFolderToolStripMenuItem.Click += new System.EventHandler(this.openPORTFolderToolStripMenuItem_Click); // // openPORTCONFIGFolderToolStripMenuItem // this.openPORTCONFIGFolderToolStripMenuItem.Name = "openPORTCONFIGFolderToolStripMenuItem"; - this.openPORTCONFIGFolderToolStripMenuItem.Size = new System.Drawing.Size(228, 22); + this.openPORTCONFIGFolderToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.openPORTCONFIGFolderToolStripMenuItem.Text = "Open \"PORT_CONFIG\" folder"; this.openPORTCONFIGFolderToolStripMenuItem.Click += new System.EventHandler(this.openPORTCONFIGFolderToolStripMenuItem_Click); // diff --git a/DoomModLoader2C/Forms/MainForm.cs b/DoomModLoader2C/Forms/MainForm.cs index 18bb736..e69686e 100644 --- a/DoomModLoader2C/Forms/MainForm.cs +++ b/DoomModLoader2C/Forms/MainForm.cs @@ -40,6 +40,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE using System.Collections.Generic; using System.Data; using System.Diagnostics; +using System.Drawing; using System.IO; using System.Linq; using System.Security.Cryptography; @@ -736,6 +737,33 @@ private void openPORTCONFIGFolderToolStripMenuItem_Click(object sender, EventArg { Process.Start(PORT_CONFIGfolderPath); } + + /// + /// When opening the preset combobox, resize the width in order to make all text visible + /// + private void cmbPreset_DropDown(object sender, EventArgs e) + { + ComboBox senderComboBox = (ComboBox)sender; + int width = senderComboBox.DropDownWidth; + Graphics g = senderComboBox.CreateGraphics(); + Font font = senderComboBox.Font; + int vertScrollBarWidth = + (senderComboBox.Items.Count > senderComboBox.MaxDropDownItems) + ? SystemInformation.VerticalScrollBarWidth : 0; + + int newWidth; + foreach (PathName p in ((ComboBox)sender).Items) + { + + newWidth = (int)g.MeasureString(p.name, font).Width + + vertScrollBarWidth; + if (width < newWidth) + { + width = newWidth; + } + } + senderComboBox.DropDownWidth = width; + } #endregion #region METHODS @@ -1758,5 +1786,6 @@ private void ApplyPreferences() #endregion + } } \ No newline at end of file