ScrollbarControlDesigner.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Windows.Forms.Design;
  7. namespace HZH_Controls.Controls
  8. {
  9. /// <summary>
  10. /// Class ScrollbarControlDesigner.
  11. /// Implements the <see cref="System.Windows.Forms.Design.ControlDesigner" />
  12. /// </summary>
  13. /// <seealso cref="System.Windows.Forms.Design.ControlDesigner" />
  14. internal class ScrollbarControlDesigner : System.Windows.Forms.Design.ControlDesigner
  15. {
  16. /// <summary>
  17. /// 获取指示组件的移动功能的选择规则。
  18. /// </summary>
  19. /// <value>The selection rules.</value>
  20. public override SelectionRules SelectionRules
  21. {
  22. get
  23. {
  24. SelectionRules selectionRules = base.SelectionRules;
  25. PropertyDescriptor propDescriptor = TypeDescriptor.GetProperties(this.Component)["AutoSize"];
  26. if (propDescriptor != null)
  27. {
  28. bool autoSize = (bool)propDescriptor.GetValue(this.Component);
  29. if (autoSize)
  30. {
  31. selectionRules = SelectionRules.Visible | SelectionRules.Moveable | SelectionRules.BottomSizeable | SelectionRules.TopSizeable;
  32. }
  33. else
  34. {
  35. selectionRules = SelectionRules.Visible | SelectionRules.AllSizeable | SelectionRules.Moveable;
  36. }
  37. }
  38. return selectionRules;
  39. }
  40. }
  41. }
  42. }