You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.6 KiB

3 years ago
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. namespace UserControlLib
  5. {
  6. public partial class User_LabelCombo : UserControl
  7. {
  8. public User_LabelCombo()
  9. {
  10. InitializeComponent();
  11. }
  12. private void User_LabelCombo_Load(object sender, EventArgs e)
  13. {
  14. comboBox.Location = new Point(label.Location.X + label.Width + 3, label.Location.Y - 4);
  15. comboBox.Width = Width - label.Width - 6;
  16. comboBox.SelectedIndex = 0;
  17. }
  18. public void ItemsAdd(string str)
  19. {
  20. comboBox.Items.Add(str);
  21. }
  22. public void Clear()
  23. {
  24. comboBox.Items.Clear();
  25. }
  26. public void ItemsAddRange(string[] str)
  27. {
  28. comboBox.Items.AddRange(str);
  29. }
  30. public ComboBoxStyle DropDownStyle
  31. {
  32. set => comboBox.DropDownStyle = value;
  33. }
  34. public string LabelText
  35. {
  36. get => label.Text;
  37. set => label.Text = value;
  38. }
  39. public string ComboText
  40. {
  41. get => comboBox.Text;
  42. set => comboBox.Text = value;
  43. }
  44. public new object Tag
  45. {
  46. get => comboBox.Tag;
  47. set => comboBox.Tag = value;
  48. }
  49. public int SelectedIndex
  50. {
  51. get => comboBox.SelectedIndex;
  52. set
  53. {
  54. if (comboBox.Items.Count > value)
  55. {
  56. comboBox.SelectedIndex = value;
  57. }
  58. }
  59. }
  60. public string UserLabelType { get; set; }
  61. }
  62. }