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

SetImage() private method

/// Override the thumbnail and peek bitmap. /// By providing this bitmap manually, Thumbnail Window manager will provide the /// Desktop Window Manager (DWM) this bitmap instead of rendering one automatically. /// Use this property to update the bitmap whenever the control is updated and the user /// needs to be shown a new thumbnail on the taskbar preview (or aero peek). /// Override the thumbnail and peek bitmap. By providing this bitmap manually, Thumbnail Window manager will provide the Desktop Window Manager (DWM) this bitmap instead of rendering one automatically. Use this property to update the bitmap whenever the control is updated and the user needs to be shown a new thumbnail on the taskbar preview (or aero peek).
/// If the bitmap doesn't have the right dimensions, the DWM may scale it or not /// render certain areas as appropriate - it is the user's responsibility /// to render a bitmap with the proper dimensions. /// If the bitmap doesn't have the right dimensions, the DWM may scale it or not render certain areas as appropriate - it is the user's responsibility to render a bitmap with the proper dimensions.
private SetImage ( IntPtr hBitmap ) : void
hBitmap System.IntPtr A bitmap handle for the image to use. /// When the TabbedThumbnail is finalized, this class will delete the provided hBitmap.
return void
        internal void SetImage(IntPtr hBitmap)
        {
            // Before we set a new bitmap, dispose the old one
            if (CurrentHBitmap != IntPtr.Zero)
            {
                ShellNativeMethods.DeleteObject(CurrentHBitmap);
            }

            // Set the new bitmap
            CurrentHBitmap = hBitmap;

            // Let DWM know to invalidate its cached thumbnail/preview and ask us for a new one
            TaskbarWindowManager.InvalidatePreview(TaskbarWindow);
        }

Same methods

TabbedThumbnail::SetImage ( Bitmap bitmap ) : void

Usage Example

Example #1
0
 public void InitalizeDWM()
 {
     TabbedThumbnail thumbnail = new TabbedThumbnail(this.Handle, Editor);
     TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(thumbnail);
     thumbnail.SetImage(new Bitmap(Editor.Image));
     thumbnail.DisplayFrameAroundBitmap = false;
     thumbnail.Title = "Paint Bucket";
     thumbnail.SetWindowIcon(this.Icon);
 }
All Usage Examples Of Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail::SetImage