/// <summary> /// Helper method to update the thumbnail preview for a given tab page. /// </summary> /// <param name="tabPage"></param> private void UpdatePreviewBitmap(TabPage tabPage) { if (tabPage != null) { TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(tabPage); if (preview != null) { Bitmap bitmap = TabbedThumbnailScreenCapture.GrabWindowBitmap(tabPage.Handle, tabPage.Size); preview.SetImage(bitmap); if (bitmap != null) { bitmap.Dispose(); bitmap = null; } } } }
/// <summary>Generate a new thumbnail image for <paramref name="tab" />.</summary> /// <param name="tab">Tab that we need to generate a thumbnail for.</param> protected void UpdateTabThumbnail(TitleBarTab tab) { TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(tab.Content); if (preview == null) { return; } Bitmap bitmap = TabbedThumbnailScreenCapture.GrabWindowBitmap(tab.Content.Handle, tab.Content.Size); preview.SetImage(bitmap); // If we already had a preview image for the tab, dispose of it if (_previews.ContainsKey(tab.Content) && _previews[tab.Content] != null) { _previews[tab.Content].Dispose(); } _previews[tab.Content] = bitmap; }
/// <summary> /// Called from <see cref="TornTabForm" /> when we need to generate a thumbnail for a tab when it is torn out of its parent window. We simply call /// <see cref="Graphics.CopyFromScreen(System.Drawing.Point,System.Drawing.Point,System.Drawing.Size)" /> to copy the screen contents to a /// <see cref="Bitmap" />. /// </summary> /// <returns>An image of the tab's contents.</returns> public virtual Bitmap GetImage() { return(TabbedThumbnailScreenCapture.GrabWindowBitmap(Content.Handle, Content.Size)); }