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); } }
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(); } } } }