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;
     }
 }
示例#3
0
        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;
            }
        }
示例#4
0
 public static void Unregister(Thumbnail handle)
 {
     if ((handle != null) && !handle.IsInvalid)
     {
         handle.Close();
     }
 }
示例#5
0
 public static extern int DwmUpdateThumbnailProperties(Thumbnail hThumbnailId, ref DwmThumbnailProperties ptnProperties);
示例#6
0
 public static extern int DwmRegisterThumbnail(IntPtr hwndDestination, IntPtr hwndSource, out Thumbnail phThumbnailId);
示例#7
0
 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);
 }