UIForm.7.Dispose.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. namespace Microsoft.Windows.Forms
  3. {
  4. partial class UIForm
  5. {
  6. /// <summary>
  7. /// 检查是否已释放资源
  8. /// </summary>
  9. public void CheckDisposed()
  10. {
  11. if (this.IsDisposed)
  12. throw new ObjectDisposedException(this.GetType().FullName);
  13. }
  14. /// <summary>
  15. /// 释放资源
  16. /// </summary>
  17. /// <param name="disposing">释放托管资源为 true,否则为 false</param>
  18. protected override void Dispose(bool disposing)
  19. {
  20. if (this.m_UIControls != null)
  21. {
  22. this.m_UIControls.Dispose();
  23. this.m_UIControls = null;
  24. }
  25. if (this.m_Sprite != null)
  26. {
  27. this.m_Sprite.Dispose();
  28. this.m_Sprite = null;
  29. }
  30. if (this.m_DoubleBufferedGraphics != null)
  31. {
  32. this.m_DoubleBufferedGraphics.Dispose();
  33. this.m_DoubleBufferedGraphics = null;
  34. }
  35. base.Dispose(disposing);
  36. }
  37. }
  38. }