ToolStripDropDownButton.cs 744 B

1234567891011121314151617181920212223242526272829
  1. namespace System.Windows.Forms
  2. {
  3. public class ToolStripDropDownButton : ToolStripDropDownButtonBase
  4. {
  5. private CustomControls.ToolStripDropDownButton button;
  6. public bool ShowDropDownArrow
  7. {
  8. get => button.ShowDropDownArrow;
  9. set => button.ShowDropDownArrow = value;
  10. }
  11. public ToolStripDropDownButton(string text) : this()
  12. {
  13. Text = text;
  14. }
  15. public ToolStripDropDownButton()
  16. {
  17. button = new();
  18. SetButton(button);
  19. button.Click += (s, e) =>
  20. {
  21. if (DropDown.Items.Count > 0 && !DropDown.Visible)
  22. DropDown.Show(this);
  23. };
  24. }
  25. }
  26. }