private void originForm_FormClosed(object sender, FormClosedEventArgs e) { if (this._thumbnail != null) { this._thumbnail.Dispose(); this._thumbnail = null; } }
private void RecomputeParentForm() { Form topLevelControl = base.TopLevelControl as Form; if (topLevelControl == null) { this._topLevelForm = null; if (this._thumbnail != null) { this._thumbnail.Dispose(); this._thumbnail = null; } } else { if ((this._thumbnail != null) && (this._topLevelForm != topLevelControl)) { this._thumbnail.Dispose(); this._thumbnail = null; } this._topLevelForm = topLevelControl; } }
public static void Unregister(Thumbnail handle) { if ((handle != null) && !handle.IsInvalid) { handle.Close(); } }
public static extern int DwmUpdateThumbnailProperties(Thumbnail hThumbnailId, ref DwmThumbnailProperties ptnProperties);
public static extern int DwmRegisterThumbnail(IntPtr hwndDestination, IntPtr hwndSource, out Thumbnail phThumbnailId);
public static extern int DwmQueryThumbnailSourceSize(Thumbnail hThumbnail, out DwmSize pSize);
public void SetThumbnail(IntPtr originHandle) { this.RecomputeParentForm(); if (this._topLevelForm == null) { throw new Exception("Control must have an owner."); } this._thumbnail = DwmManager.Register(this._topLevelForm, originHandle); this.UpdateThumbnail(base.Visible); }