日期:2014-05-18 浏览次数:20959 次
/// <summary> /// 关闭窗体 /// </summary> private void CloseFrom() { if (t != null && t.IsAlive) { t.Abort(); t = null; } if (thumbnail != null) { thumbnail = null; thumbnail.Dispose(); } if (tempBit != null) { tempBit.Dispose(); tempBit = null; } if (tempBitmap != null) { tempBitmap.Dispose(); tempBitmap = null; } if (dsImage != null) { dsImage.Dispose(); dsImage = null; } if (img != null) { img.Dispose(); img = null; } #region 释放控件 this.pbHeadPicture.Image.Dispose(); this.pbHeadPicture.Dispose(); this.pbHeadPicture = null; this.pnlAdjustment.BackgroundImage.Dispose(); this.pnlAdjustment.Dispose(); this.pnlAdjustment = null; this.pnlGender2.Dispose(); this.pnlGender2 = null; this.pnlPhotoBG.Dispose(); this.pnlPhotoBG = null; this.picClose.Image.Dispose(); this.picClose.Dispose(); this.picClose = null; this.picFemale.Dispose(); this.picFemale.Dispose(); this.picFemale = null; this.picGenderOK.Image.Dispose(); this.picGenderOK.Dispose(); this.picGenderOK = null; this.picGenderReturn.Image.Dispose(); this.picGenderReturn.Dispose(); this.picGenderReturn = null; this.picJia.Image.Dispose(); this.picJia.Dispose(); this.picJia = null; this.picJian.Image.Dispose(); this.picJian.Dispose(); this.picJian = null; this.picLeft.Image.Dispose(); this.picLeft.Dispose(); this.picLeft = null; this.picMale.Image.Dispose(); this.picMale.Dispose(); this.picMale = null; this.picOK.Image.Dispose(); this.picOK.Dispose(); this.picOK = null; this.picReturn.Image.Dispose(); this.picReturn.Dispose(); this.picReturn = null; this.picRight.Image.Dispose(); this.picRight.Dispose(); this.picRight = null; this.picJiaoCheng.Image.Dispose(); this.picJiaoCheng.Dispose(); this.picJiaoCheng = null; #endregion if (apfShowPicture != null) { apfShowPicture.Dispose(); apfShowPicture = null; } if (transKuangForm != null) { transKuangForm.Dispose(); transKuangForm.Close(); transKuangForm = null; } if (controlForm != null) { controlForm.Dispose(); controlForm.Close(); controlForm = null; } if (dengDaiForm != null) { dengDaiForm.Dispose(); dengDaiForm.Close(); dengDaiForm = null; } this.Dispose(); } //怎么和这个结合起来呢? class R:IDisposable { R() {} ~R() { Dispose(false); } public void Dispose() { GC.SuppressFinalize(this); Dispose(true);