Ejemplo n.º 1
0
        private void FillAudioRenderers()
        {
            int nCount;

            m_objPreview.PropsOptionGetCount("audio_renderer", out nCount);

            if (nCount > 0)
            {
                // Auto width of combobox
                int      width    = comboBoxAudioRenderers.DropDownWidth;
                Graphics g        = comboBoxAudioRenderers.CreateGraphics();
                Font     font     = comboBoxAudioRenderers.Font;
                int      newWidth = 0;

                //Fill the List Box with renderer names
                for (int i = 0; i < nCount; i++)
                {
                    string name, help;
                    m_objPreview.PropsOptionGetByIndex("audio_renderer", i, out name, out help);

                    comboBoxAudioRenderers.Items.Add(name);

                    newWidth = (int)g.MeasureString(name, font).Width;
                    if (width < newWidth)
                    {
                        width = newWidth;
                    }
                }

                comboBoxAudioRenderers.DropDownWidth = width;

                if (comboBoxAudioRenderers.Items.Count > 0)
                {
                    comboBoxAudioRenderers.SelectedIndex = 0;
                }
            }
        }