示例#1
0
        private void UpdateThumbnail(Point location, Size size)
        {
            DWM_THUMBNAIL_PROPERTIES properties = new DWM_THUMBNAIL_PROPERTIES()
            {
                dwFlags = DWM_TNP.DWM_TNP_OPACITY | DWM_TNP.DWM_TNP_RECTDESTINATION | DWM_TNP.DWM_TNP_RECTSOURCE | DWM_TNP.DWM_TNP_SOURCECLIENTAREAONLY | DWM_TNP.DWM_TNP_VISIBLE,
                fSourceClientAreaOnly = ClientAreaOnly,
                fVisible      = true,
                opacity       = (byte)(Byte.MaxValue * Opacity),
                rcDestination = new RECT(location.X, location.Y, size.Width, size.Height),
                rcSource      = new RECT(DrawnRegion),
            };

            if (DesktopWindowManager.Update(thumbnail, ref properties))
            {
                OnThumbnailUpdated(this, EventArgs.Empty);
            }
            else
            {
                OnThumbnailUpdateFailed(this, EventArgs.Empty);
            }
        }
示例#2
0
 private void UpdateThubmnail()
 {
     if (thumbnail != IntPtr.Zero)
     {
         DWM_THUMBNAIL_PROPERTIES properties = new DWM_THUMBNAIL_PROPERTIES()
         {
             dwFlags = DWM_TNP.DWM_TNP_OPACITY | DWM_TNP.DWM_TNP_RECTDESTINATION | DWM_TNP.DWM_TNP_RECTSOURCE | DWM_TNP.DWM_TNP_SOURCECLIENTAREAONLY | DWM_TNP.DWM_TNP_VISIBLE,
             fSourceClientAreaOnly = ClientAreaOnly,
             fVisible      = Visible & !IsFixed,
             opacity       = Byte.MaxValue,
             rcDestination = new RECT(Location, Size),
             rcSource      = new RECT(DrawnRegion)
         };
         if (!DesktopWindowManager.Update(thumbnail, ref properties))
         {
             if (MessageBox.Show("サムネイルの更新に失敗しました。", "エラー", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry)
             {
                 UnsetWindow();
             }
         }
     }
 }
示例#3
0
 private static extern int DwmUpdateThumbnailProperties(IntPtr hThumb, ref DWM_THUMBNAIL_PROPERTIES props);
示例#4
0
 public static bool Update(IntPtr thumbnail, ref DWM_THUMBNAIL_PROPERTIES properties)
 {
     return(DwmUpdateThumbnailProperties(thumbnail, ref properties) == S_OK);
 }