Sprite.Method.03.IDisposable.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. namespace Microsoft.Windows.Forms
  2. {
  3. partial class Sprite
  4. {
  5. /// <summary>
  6. /// 释放托管资源
  7. /// </summary>
  8. protected virtual void DisposeResources()
  9. {
  10. //=================取消引用
  11. this.m_Owner = null;
  12. //=================取消引用
  13. this.m_BackgroundImage = null;
  14. this.m_BackgroundImageHovered = null;
  15. this.m_BackgroundImagePressed = null;
  16. this.m_BackgroundImageFocused = null;
  17. this.m_BackgroundImageDisabled = null;
  18. this.m_BackgroundImageHighlight = null;
  19. this.m_BackgroundImage9 = null;
  20. this.m_BackgroundImage9Hovered = null;
  21. this.m_BackgroundImage9Pressed = null;
  22. this.m_BackgroundImage9Focused = null;
  23. this.m_BackgroundImage9Disabled = null;
  24. this.m_BackgroundImage9Highlight = null;
  25. this.m_Font = null;
  26. this.m_Image = null;
  27. this.m_ImageHovered = null;
  28. this.m_ImagePressed = null;
  29. this.m_ImageFocused = null;
  30. this.m_ImageDisabled = null;
  31. this.m_ImageHighlight = null;
  32. }
  33. /// <summary>
  34. /// 释放中间引用值
  35. /// </summary>
  36. protected virtual void DisposeReferences()
  37. {
  38. //=================剪切区相关
  39. this.m_Graphics = null;//取消引用
  40. if (this.m_GraphicsClip != null)//在BeginRender
  41. {
  42. this.m_GraphicsClip.Dispose();
  43. this.m_GraphicsClip = null;
  44. }
  45. //=================绘制参数
  46. if (this.m_CurrentBackColorPath != null)
  47. {
  48. this.m_CurrentBackColorPath.Dispose();
  49. this.m_CurrentBackColorPath = null;
  50. }
  51. this.m_CurrentBackColor = null;
  52. this.m_CurrentBackColorReverse = null;
  53. this.m_CurrentBackColorMode = null;
  54. this.m_CurrentBackColorPathRect = null;
  55. this.m_CurrentBackColorBrushRect = null;
  56. this.m_CurrentBackgroundImage = null;
  57. this.m_CurrentBackgroundImageRect = null;
  58. this.m_CurrentBackgroundImage9 = null;
  59. this.m_CurrentBackgroundImage9Rect = null;
  60. this.m_CurrentBorderColor = null;
  61. this.m_CurrentBorderPathRect = null;
  62. this.m_CurrentBorderBrushRect = null;
  63. this.m_CurrentInnerBorderColor = null;
  64. this.m_CurrentInnerBorderPathRect = null;
  65. this.m_CurrentInnerBorderBrushRect = null;
  66. this.m_CurrentStringClientRect = null;
  67. this.m_CurrentStringRect = null;
  68. this.m_CurrentStringPathRect = null;
  69. this.m_CurrentStringSize = null;
  70. this.m_CurrentTextImageClientRect = null;
  71. this.m_CurrentTextImagePreferredRect = null;
  72. this.m_CurrentTextPreferredRect = null;
  73. this.m_CurrentForeColor = null;
  74. this.m_CurrentImagePreferredRect = null;
  75. this.m_CurrentImage = null;
  76. this.m_CurrentLineColor = null;
  77. }
  78. /// <summary>
  79. /// 释放资源
  80. /// </summary>
  81. /// <param name="disposing">释放托管资源为true,否则为false</param>
  82. protected override void Dispose(bool disposing)
  83. {
  84. this.DisposeReferences();
  85. this.DisposeResources();
  86. }
  87. }
  88. }