■No91569 (kiku さん) に返信 > foreach (var c in Controls) > { > Logger.Info(c.GetType().ToString()); > switch (c.GetType().FullName) > { > case "System.Windows.Forms.Label": > ((System.Windows.Forms.Label)c).Font.Dispose(); > ((System.Windows.Forms.Label)c).Dispose(); 型ではなく型名でチェックしている点が気になりますが、それはさておき。 Form 上に Panel や TabControl 等を使用していた場合、this.Controls だけではなく その配下のコントロールも再帰的に処理する必要があるのではないでしょうか。 (this.Controls[0].Controls 的な意味で) https://stackoverflow.com/questions/2209854/find-all-child-controls-of-specific-type-using-enumerable-oftypet-or-linq > protected override void Dispose(bool disposing) > { > CustomDispose.Dispose(this.Controls);//★対策追加 > if (disposing && (components != null)) > { > components.Dispose(); > } > base.Dispose(disposing); > } マネージリソースを破棄するのは、disposing == true の時だけなのでは? # 一応、解決済みマークはつけたままにしておきます。
- Child Tree -