Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail.InvalidatePreview C# (CSharp) Method

InvalidatePreview() public method

Invalidate any existing thumbnail preview. Calling this method will force DWM to request a new bitmap next time user previews the thumbnails or requests Aero peek preview.
public InvalidatePreview ( ) : void
return void
        public void InvalidatePreview()
        {
            // clear current image and invalidate
            SetImage(IntPtr.Zero);
        }

Usage Example

        /// <summary>
        /// Adds a new tabbed thumbnail to the taskbar.
        /// </summary>
        /// <param name="preview">Thumbnail preview for a specific window handle or control. The preview
        /// object can be initialized with specific properties for the title, bitmap, and tooltip.</param>
        /// <exception cref="System.ArgumentException">If the tabbed thumbnail has already been added</exception>
        public void AddThumbnailPreview(TabbedThumbnail preview)
        {
            if (preview == null) { throw new ArgumentNullException(nameof(preview)); }

            // UI Element has a windowHandle of zero.
            if (preview.WindowHandle == IntPtr.Zero)
            {
                if (_tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl))
                {
                    throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewAdded, nameof(preview));
                }
                _tabbedThumbnailCacheWPF.Add(preview.WindowsControl, preview);
            }
            else
            {
                // Regular control with a valid handle
                if (_tabbedThumbnailCache.ContainsKey(preview.WindowHandle))
                {
                    throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewAdded, nameof(preview));
                }
                _tabbedThumbnailCache.Add(preview.WindowHandle, preview);
            }

            TaskbarWindowManager.AddTabbedThumbnail(preview);

            preview.InvalidatePreview(); // Note: Why this here?
        }
All Usage Examples Of Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail::InvalidatePreview