Ribbon.Controls.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Windows;
  2. using System.Windows.Forms;
  3. namespace FastReport.Design.RibbonDesigner
  4. {
  5. internal class RibbonGroupCaption : Label
  6. {
  7. public override bool Visible
  8. {
  9. get => base.Visible;
  10. set
  11. {
  12. base.Visible = value;
  13. control.Visibility = value ? Visibility.Visible : Visibility.Collapsed;
  14. }
  15. }
  16. public RibbonGroupCaption()
  17. {
  18. AutoSize = true;
  19. control.Height = 15;
  20. control.FontSize = 11;
  21. control.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
  22. control.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
  23. control.VerticalContentAlignment = VerticalAlignment.Bottom;
  24. control.Margin = new Thickness(0, 0, 0, 1);
  25. }
  26. }
  27. internal class ToolbarLayoutDropDownButton : ToolStripDropDownButton, IToolbarItem
  28. {
  29. public bool BeginGroup { get; set; }
  30. public ToolbarLayoutDropDownButton()
  31. {
  32. DropDown = new ToolStripDropDown();
  33. DropDown.Opened += (s, e) =>
  34. {
  35. OnDropDownOpened(e);
  36. IsDropDownOpen = true;
  37. };
  38. DropDown.Closed += (s, e) =>
  39. {
  40. OnDropDownClosed(e);
  41. IsDropDownOpen = false;
  42. };
  43. DropDown.Opening += (s, e) => OnDropDownOpening(e);
  44. }
  45. }
  46. internal class ToolbarLabel : Label, IToolbarItem
  47. {
  48. public bool BeginGroup { get; set; }
  49. public ToolbarLabel()
  50. {
  51. AutoSize = true;
  52. control.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
  53. control.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
  54. }
  55. }
  56. }