Closed Premo36 closed 2 years ago
Implement something like this code (taken from https://stackoverflow.com/questions/48573024/add-scrollbar-to-winforms-combobox/48573154) to make the preset list as large as the longest preset name so it's always visible.
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 (string s in ((ComboBox)sender).Items) { newWidth = (int)g.MeasureString(s, font).Width + vertScrollBarWidth; if (width < newWidth) { width = newWidth; } } senderComboBox.DropDownWidth = width;
Implement something like this code (taken from https://stackoverflow.com/questions/48573024/add-scrollbar-to-winforms-combobox/48573154) to make the preset list as large as the longest preset name so it's always visible.