AuxiliaryLine.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // ***********************************************************************
  2. // Assembly : HZH_Controls
  3. // Created : 2019-09-17
  4. //
  5. // ***********************************************************************
  6. // <copyright file="AuxiliaryLine.cs">
  7. // Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
  8. // </copyright>
  9. //
  10. // Blog: https://www.cnblogs.com/bfyx
  11. // GitHub:https://github.com/kwwwvagaa/NetWinformControl
  12. // gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
  13. //
  14. // If you use this code, please keep this note.
  15. // ***********************************************************************
  16. using System;
  17. using System.Drawing;
  18. namespace HZH_Controls.Controls
  19. {
  20. /// <summary>
  21. /// Class AuxiliaryLine.
  22. /// Implements the <see cref="System.IDisposable" />
  23. /// </summary>
  24. /// <seealso cref="System.IDisposable" />
  25. internal class AuxiliaryLine : IDisposable
  26. {
  27. private bool disposedValue = false;
  28. public float Value
  29. {
  30. get;
  31. set;
  32. }
  33. public float PaintValue
  34. {
  35. get;
  36. set;
  37. }
  38. public float PaintValueBackUp
  39. {
  40. get;
  41. set;
  42. }
  43. public Color LineColor
  44. {
  45. get;
  46. set;
  47. }
  48. public Pen PenDash
  49. {
  50. get;
  51. set;
  52. }
  53. public Pen PenSolid
  54. {
  55. get;
  56. set;
  57. }
  58. public float LineThickness
  59. {
  60. get;
  61. set;
  62. }
  63. public Brush LineTextBrush
  64. {
  65. get;
  66. set;
  67. }
  68. public bool IsLeftFrame
  69. {
  70. get;
  71. set;
  72. }
  73. private bool isDashStyle = true;
  74. public bool IsDashStyle
  75. {
  76. get { return isDashStyle; }
  77. set { isDashStyle = value; }
  78. }
  79. public Pen GetPen()
  80. {
  81. return IsDashStyle ? PenDash : PenSolid;
  82. }
  83. protected virtual void Dispose(bool disposing)
  84. {
  85. if (!disposedValue)
  86. {
  87. if (disposing)
  88. {
  89. if(PenDash==null)
  90. PenDash.Dispose();
  91. if(PenSolid==null)
  92. PenSolid.Dispose();
  93. if(LineTextBrush==null)
  94. LineTextBrush.Dispose();
  95. }
  96. disposedValue = true;
  97. }
  98. }
  99. public string Tip { get; set; }
  100. public void Dispose()
  101. {
  102. Dispose(true);
  103. }
  104. }
  105. }