Пример #1
0
        public static void fillComboBoxFromArray(CoolComboBox comboBox, String[] sArray)
        {
            //remove all existing items
            comboBox.Clear();

            //populate the combo
            foreach (String s in sArray)
            {
                comboBox.addItem(s);
            }
        }
Пример #2
0
        public static void fillComboBoxFromArray(CoolComboBox comboBox, String[] sArray)
        {
            //remove all existing items
            comboBox.Clear();

            //populate the combo
            foreach (String s in sArray)
            {
                comboBox.addItem(s);
            }
        }
Пример #3
0
        public static void AdjustWidthComboBox(CoolComboBox comboBox)
        {
            int width = comboBox.DropDownWidth;
            Graphics g = comboBox.autoCompleteComboBox1.CreateGraphics();
            Font font = comboBox.autoCompleteComboBox1.Font;
            int vertScrollBarWidth =
                (comboBox.Items.Count > comboBox.MaxDropDownItems)
                    ? SystemInformation.VerticalScrollBarWidth
                    : 0;

            int newWidth;
            foreach (string s in (comboBox.Items))
            {
                newWidth = (int)g.MeasureString(s, font).Width
                           + vertScrollBarWidth;
                if (width < newWidth)
                {
                    width = newWidth;
                }
            }
            comboBox.DropDownWidth = width;
            comboBox.PopupWidth = width;
        }
Пример #4
0
        public static void AdjustWidthComboBox(CoolComboBox comboBox)
        {
            int width = comboBox.DropDownWidth;
            Graphics g = comboBox.autoCompleteComboBox1.CreateGraphics();
            Font font = comboBox.autoCompleteComboBox1.Font;
            int vertScrollBarWidth =
                (comboBox.Items.Count > comboBox.MaxDropDownItems)
                    ? SystemInformation.VerticalScrollBarWidth
                    : 0;

            int newWidth;
            foreach (string s in (comboBox.Items))
            {
                newWidth = (int)g.MeasureString(s, font).Width
                           + vertScrollBarWidth;
                if (width < newWidth)
                {
                    width = newWidth;
                }
            }
            comboBox.DropDownWidth = width;
            comboBox.PopupWidth = width;
        }