using System; using System.Drawing; using System.Windows.Forms; namespace UserControlLib { public partial class User_LabelCombo : UserControl { public User_LabelCombo() { InitializeComponent(); } private void User_LabelCombo_Load(object sender, EventArgs e) { comboBox.Location = new Point(label.Location.X + label.Width + 3, label.Location.Y - 4); comboBox.Width = Width - label.Width - 6; comboBox.SelectedIndex = 0; } public void ItemsAdd(string str) { comboBox.Items.Add(str); } public void Clear() { comboBox.Items.Clear(); } public void ItemsAddRange(string[] str) { comboBox.Items.AddRange(str); } public ComboBoxStyle DropDownStyle { set => comboBox.DropDownStyle = value; } public string LabelText { get => label.Text; set => label.Text = value; } public string ComboText { get => comboBox.Text; set => comboBox.Text = value; } public new object Tag { get => comboBox.Tag; set => comboBox.Tag = value; } public int SelectedIndex { get => comboBox.SelectedIndex; set { if (comboBox.Items.Count > value) { comboBox.SelectedIndex = value; } } } public string UserLabelType { get; set; } } }