private void CloseInstances() { foreach (String key in _instances.Keys.ToList()) { if (_config.Accounts.Where(o => o.Guid == key).Count() > 0) { continue; } Notifier form = _instances[key]; TabbedThumbnail thumbnailPreview = _taskbarManager.TabbedThumbnail.GetThumbnailPreview(form.Handle); thumbnailPreview.TabbedThumbnailClosed -= _Preview_TabbedThumbnailClosed; _taskbarManager.TabbedThumbnail.RemoveThumbnailPreview(thumbnailPreview); this._UnreadTotal -= form.Unread; _instances.Remove(key); form.Close(); } if (_config.Accounts.Count > 0) { _taskbarManager.TabbedThumbnail.SetActiveTab(_instances[_config.Accounts[0].Guid].Handle); } }
public static void RemoveButtons(TabbedThumbnail preview) { if (buttonList.ContainsKey(preview)) { buttonList.Remove(preview); } }
private void TabItem_Loaded(object sender, RoutedEventArgs e) { var tabItem = sender as TabItem; if (TaskbarManager.IsPlatformSupported) { var data = (WorkspaceViewModel)((TabItem)sender).DataContext; tabItem.Loaded -= TabItem_Loaded; var point = tabItem.TranslatePoint(new System.Windows.Point(), this); var preview = new TabbedThumbnail(this, tabItem, new Vector(0, point.Y)) { Title = data.Header }; if (data is QDocument doc && doc.Document != null) { preview.Tooltip = doc.Document.Package.Name; } preview.TabbedThumbnailMinimized += Preview_TabbedThumbnailMinimized; preview.TabbedThumbnailMaximized += Preview_TabbedThumbnailMaximized; preview.TabbedThumbnailActivated += Preview_TabbedThumbnailActivated; preview.TabbedThumbnailClosed += Preview_TabbedThumbnailClosed; preview.TabbedThumbnailBitmapRequested += Preview_TabbedThumbnailBitmapRequested; preview.SetWindowIcon(Properties.Resources.Icon.GetHicon()); TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview); } tabControl1.SelectedItem = tabItem; }
private async void LoadJumplist() { await System.Threading.Tasks.Task.Delay(5000); JumpList jl = JumpList.CreateJumpList(); JumpListCustomCategory jlc = new JumpListCustomCategory("µVoice Alpha (Private Build)"); JumpListLink[] jli = new JumpListLink[] { new JumpListLink("report", "Reportar Un Problema"), new JumpListLink("reports", "Decirle a bit que es mierda."), new JumpListLink("update", "Buscar Actualizaciones") }; jlc.AddJumpListItems(jli); jl.AddCustomCategories(jlc); jl.Refresh(); TaskbarManager.Instance.TabbedThumbnail.SetThumbnailClip(new WindowInteropHelper(this).Handle, new System.Drawing.Rectangle(10, 64, Convert.ToInt32(mainpiano.ActualWidth), Convert.ToInt32(mainpiano.ActualHeight))); TabbedThumbnail preview = new TabbedThumbnail(this, mainpiano, new System.Windows.Vector(10000, 10000)); preview.SetWindowIcon(Properties.Resources.icon); preview.Title = this.Title; try { TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview); } catch { } RenderTargetBitmap rtb = new RenderTargetBitmap((int)play.ActualWidth, (int)play.ActualHeight, 96, 96, PixelFormats.Pbgra32); rtb.Render(play); MemoryStream stream = new MemoryStream(); BitmapEncoder encoder = new BmpBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(rtb)); encoder.Save(stream); System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(stream); TaskbarManager.Instance.ThumbnailToolBars.AddButtons(mainpiano, new ThumbnailToolBarButton[] { new ThumbnailToolBarButton(System.Drawing.Icon.FromHandle(bmp.GetHicon()), "Play") }); }
private static void CreateContentPreview(UIElement content) { if (!_initialized) { throw new Exception("Not initialized"); } //if (_previewOffset.X == 0.0 && _previewOffset.Y == 0.0) //probably not calculated yet // _previewOffset = SetThumbnailOffset((Frame) content); var offset = SetThumbnailOffset((Frame)content); TabbedThumbnail thumbnail = new TabbedThumbnail(ParentWindow, content, offset); if (!TaskbarManager.Instance.TabbedThumbnail.IsThumbnailPreviewAdded(thumbnail)) //only once { thumbnail.TabbedThumbnailActivated += new EventHandler <TabbedThumbnailEventArgs>(thumbnail_TabbedThumbnailActivated); thumbnail.TabbedThumbnailClosed += new EventHandler <TabbedThumbnailClosedEventArgs>(thumbnail_TabbedThumbnailClosed); thumbnail.TabbedThumbnailMaximized += new EventHandler <TabbedThumbnailEventArgs>(thumbnail_TabbedThumbnailMaximized); thumbnail.TabbedThumbnailMinimized += new EventHandler <TabbedThumbnailEventArgs>(thumbnail_TabbedThumbnailMinimized); thumbnail.DisplayFrameAroundBitmap = false; thumbnail.ClippingRectangle = new Rectangle(100, 100, 100, 100); //NOTE: ADDING TOOLBAR BUTTON, DOES NOT WORK WHILE DEBUGGING. USUALLY. TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(thumbnail); ThumbnailButtonsHelper.AddTaskbarButtons(content); ThumbnailButtonsHelper.UpdateButtonStatus((Frame)content); //Called when using history (it fires even when tab is not active, frame_contentRendered doesn't) ((Frame)content).LoadCompleted += (sender, args) => { var frame = sender as Frame; RefreshPreview(frame); ReorderAllPreviews(); ThumbnailButtonsHelper.UpdateButtonStatus(frame); }; } }
private static void SetThumbnailTitleAndIcon(UIElement content, IControlView activeView) { if (!_initialized) { throw new Exception("Not initialized"); } TabbedThumbnail thumbnail = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(content); if (thumbnail != null && activeView != null) { if (thumbnail.Title != activeView.Header) //Title is not set yet or sth has changed { thumbnail.Title = activeView.Header; thumbnail.Tooltip = activeView.HeaderToolTip; var streamResourceInfo = Application.GetResourceStream(activeView.HeaderIcon); if (streamResourceInfo != null) { Stream iconStream = streamResourceInfo.Stream; var bitmap = new Bitmap(iconStream); var iconHandle = bitmap.GetHicon(); var icon = Icon.FromHandle(iconHandle); thumbnail.SetWindowIcon(icon); } RefreshPreview((Frame)content); } } }
/// <summary> /// Creates a new thumbnail for <paramref name="tab" /> when the application is initially enabled for AeroPeek or when it is turned on sometime during /// execution. /// </summary> /// <param name="tab">Tab that we are to create the thumbnail for.</param> /// <returns>Thumbnail created for <paramref name="tab" />.</returns> protected virtual TabbedThumbnail CreateThumbnailPreview(TitleBarTab tab) { TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(tab.Content); if (preview != null) { TaskbarManager.Instance.TabbedThumbnail.RemoveThumbnailPreview(tab.Content); } preview = new TabbedThumbnail(Handle, tab.Content) { Title = tab.Content.Text, Tooltip = tab.Content.Text }; preview.SetWindowIcon((Icon)tab.Content.Icon.Clone()); preview.TabbedThumbnailActivated += preview_TabbedThumbnailActivated; preview.TabbedThumbnailClosed += preview_TabbedThumbnailClosed; preview.TabbedThumbnailBitmapRequested += preview_TabbedThumbnailBitmapRequested; preview.PeekOffset = new Vector(Padding.Left, Padding.Top - 1); TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview); return(preview); }
private void CloseInstances() { List <string> list = new List <string>(); foreach (Notifier notifier in _instances.Values) { if (_config.Accounts[notifier.AccountIndex] == null) { list.Add(notifier.Text); } } foreach (string str in list) { TabbedThumbnail thumbnailPreview = _taskbarManager.TabbedThumbnail.GetThumbnailPreview(_instances[str].Handle); thumbnailPreview.TabbedThumbnailClosed -= _Preview_TabbedThumbnailClosed; _taskbarManager.TabbedThumbnail.RemoveThumbnailPreview(thumbnailPreview); this._UnreadTotal -= _instances[str].Unread; _instances[str].Close(); } if (_config.Accounts.Count > 0) { _taskbarManager.TabbedThumbnail.SetActiveTab(_instances[_config.Accounts[0].FullAddress].Handle); } }
/// <summary> /// Open a user-specified text file in a new tab (using a RichTextBox) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { // Open text file CommonOpenFileDialog cfd = new CommonOpenFileDialog(); CommonFileDialogStandardFilters.TextFiles.ShowExtensions = true; CommonFileDialogFilter rtfFilter = new CommonFileDialogFilter("RTF Files", ".rtf"); rtfFilter.ShowExtensions = true; cfd.Filters.Add(CommonFileDialogStandardFilters.TextFiles); cfd.Filters.Add(rtfFilter); if (cfd.ShowDialog() == CommonFileDialogResult.Ok) { TabPage newTab = new TabPage(Path.GetFileName(cfd.FileName)); tabControl1.TabPages.Add(newTab); RichTextBox rtbText = new RichTextBox(); rtbText.KeyDown += new KeyEventHandler(rtbText_KeyDown); rtbText.MouseMove += new MouseEventHandler(rtbText_MouseMove); rtbText.KeyUp += new KeyEventHandler(rtbText_KeyUp); rtbText.Dock = DockStyle.Fill; // Based on the extension, load the file appropriately in the RichTextBox if (Path.GetExtension(cfd.FileName).ToLower() == ".txt") { rtbText.LoadFile(cfd.FileName, RichTextBoxStreamType.PlainText); } else if (Path.GetExtension(cfd.FileName).ToLower() == ".rtf") { rtbText.LoadFile(cfd.FileName, RichTextBoxStreamType.RichText); } // Update the tab newTab.Controls.Add(rtbText); // Add a new preview TabbedThumbnail preview = new TabbedThumbnail(this.Handle, newTab.Handle); // Event handlers for this preview preview.TabbedThumbnailActivated += preview_TabbedThumbnailActivated; preview.TabbedThumbnailClosed += preview_TabbedThumbnailClosed; preview.TabbedThumbnailMaximized += preview_TabbedThumbnailMaximized; preview.TabbedThumbnailMinimized += preview_TabbedThumbnailMinimized; preview.ClippingRectangle = GetClippingRectangle(rtbText); TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview); // Add thumbnail toolbar buttons TaskbarManager.Instance.ThumbnailToolBars.AddButtons(newTab.Handle, thumbButtonCut, thumbButtonCopy, thumbButtonPaste, thumbButtonSelectAll); // Select the tab in the application UI as well as taskbar tabbed thumbnail list tabControl1.SelectedTab = newTab; TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(tabControl1.SelectedTab); button2.Enabled = true; button4.Enabled = true; } }
// Remove the passed-in TabbedThumbnail preview object private void RemoveThumbnailPreview(TabbedThumbnail preview) { // Remove the Thumbnail preview TaskbarManager.Instance.TabbedThumbnail. RemoveThumbnailPreview(preview); // Remove the Thumbnail preivew from the list tabbedThumbnailList.Remove(preview); }
void rtbText_MouseMove(object sender, MouseEventArgs e) { TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview((Control)sender); if (preview != null) { preview.ClippingRectangle = GetClippingRectangle((RichTextBox)sender); } }
//The following method is part of the lab. Create a thumbnail and register for the event so that //you can render its bitmap on demand. Use an offset from the main window to the black image. private void createThumbnail(IntPtr displayHandle) { if (displayHandle != IntPtr.Zero && windowsTaskbar.TabbedThumbnail.GetThumbnailPreview(displayHandle) == null) { TabbedThumbnail preview = new TabbedThumbnail((IntPtr)mcRef.GetWindowHandle(), displayHandle); windowsTaskbar.TabbedThumbnail.AddThumbnailPreview(preview); windowsTaskbar.TabbedThumbnail.SetActiveTab(preview); } }
private void Notifier_Activated(object sender, EventArgs e) { this.Refresh(); TabbedThumbnail thumb = _TaskbarManager.TabbedThumbnail.GetThumbnailPreview(this); //_PictureLogo); if (thumb != null) { thumb.InvalidatePreview(); } }
/// <summary> /// Handler method that's called when Aero Peek needs to display a thumbnail for a <see cref="TitleBarTab" />; finds the preview bitmap generated in /// <see cref="TabDeselecting" /> and returns that. /// </summary> /// <param name="sender">Object from which this event originated.</param> /// <param name="e">Arguments associated with this event.</param> private void preview_TabbedThumbnailBitmapRequested(object sender, TabbedThumbnailBitmapRequestedEventArgs e) { foreach ( TitleBarTab rdcWindow in Tabs.Where(rdcWindow => rdcWindow.Content.Handle == e.WindowHandle && _previews.ContainsKey(rdcWindow.Content))) { TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(rdcWindow.Content); preview.SetImage(_previews[rdcWindow.Content]); break; } }
private void Notifier_Activated(object sender, EventArgs e) { this.Refresh(); using (TabbedThumbnail thumb = _taskbarManager.TabbedThumbnail.GetThumbnailPreview(this)) { if (thumb != null) { thumb.InvalidatePreview(); } } }
/// <summary> /// Обновить можно только текущий открытый thumbnail /// </summary> private bool UpdateCurrentPreview(TabbedThumbnail thumbnail = null) { if (!TaskbarManager.IsPlatformSupported) { return(false); } if (tabControl1.SelectedItem is TabItem tabItem) { var preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(tabItem); if (preview != null && (preview == thumbnail || thumbnail == null)) { if (!(tabItem.Content is FrameworkElement element) || element.ActualWidth < 1.0 || element.ActualHeight < 1.0) { return(false); } var image = new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight, 96, 96, PixelFormats.Default); var dv = new DrawingVisual(); using (DrawingContext dc = dv.RenderOpen()) { var vb = new VisualBrush(element) { Stretch = Stretch.None, AlignmentX = AlignmentX.Left, AlignmentY = AlignmentY.Top }; var rect = new Rect(new System.Windows.Point(), new Size((int)element.ActualWidth, (int)element.ActualHeight)); dc.DrawRectangle(new SolidColorBrush(Colors.White), null, rect); dc.DrawRectangle(vb, null, rect); } image.Render(dv); try { preview.SetImage(image); var point = element.TranslatePoint(new System.Windows.Point(), this); preview.PeekOffset = new Vector(point.X, point.Y + 1); return(true); } catch { return(false); } } } return(false); }
// Remove the Thumbnail preview which is the image on // preivewPictureBox1 private void removeThumbnailButton2_Click(object sender, EventArgs e) { // Try to retrieve the Thumbnail preview TabbedThumbnail preview = TaskbarManager.Instance. TabbedThumbnail.GetThumbnailPreview(previewPictureBox2); if (preview != null) { // Remove the Thumbnail preview this.RemoveThumbnailPreview(preview); // Update the buttons' enable status removeThumbnailButton2.Enabled = false; addThumbnailButton2.Enabled = true; } }
// Make the given Control as the Thumbnail preview private void AddThumbnailPreview(Control control) { // Make a new Thumbnail preview object TabbedThumbnail preview = new TabbedThumbnail(this.Handle, control); // Make the given Control as the Thumbnail preview TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview( preview); // Set the newly created Thumbnail preview as active TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(preview); // Add the Thumbnail preview into the list tabbedThumbnailList.Add(preview); }
/// <summary> /// Event handler that is called when a tab's <see cref="Form.Text" /> property is changed, which re-renders the tab text and updates the title of the /// Aero Peek preview. /// </summary> /// <param name="sender">Object from which this event originated (the <see cref="TitleBarTab.Content" /> object in this case).</param> /// <param name="e">Arguments associated with the event.</param> private void Content_TextChanged(object sender, EventArgs e) { if (AeroPeekEnabled) { TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview((Form)sender); if (preview != null) { preview.Title = (sender as Form).Text; } } if (_overlay != null) { _overlay.Render(true); } }
public TaskbarThumbnail() { InitializeComponent(); if (!DesignMode) { taskbarForm = new TaskbarForm(); TabbedThumbnail preview = new TabbedThumbnail(taskbarForm.Handle, taskbarForm.Handle); TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview); preview.TabbedThumbnailBitmapRequested += (o, e) => { Bitmap bmp = new Bitmap(Width, Height); DrawToBitmap(bmp, new Rectangle(new Point(0, 0), bmp.Size)); preview.SetImage(bmp); e.Handled = true; }; } }
void wb_DocumentTitleChanged(object sender, System.EventArgs e) { // When the webpage's title changes, // update the tab's title and taskbar thumbnail's title TabPage page = ((WebBrowser)sender).Parent as TabPage; if (page != null) { page.Text = ((WebBrowser)sender).DocumentTitle; TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(page); if (preview != null) { preview.Title = page.Text; } } }
private void Thumbnail_Shown(object sender, EventArgs e) { this.thumbButtonNext = new ThumbnailToolbarButton(this.Icon, "Next"); this.thumbButtonNext.Enabled = true; this.thumbButtonNext.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(thumbButtonNext_Click); this.thumbButtonPrev = new ThumbnailToolbarButton(this.Icon, "Prev"); this.thumbButtonPrev.Enabled = true; this.thumbButtonPrev.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(thumbButtonPrev_Click); TabbedThumbnail thumb = new TabbedThumbnail(this.Handle, this.Handle); thumb.SetImage(Properties.Resources.Thumb); TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(thumb); TaskbarManager.Instance.ThumbnailToolbars.AddButtons(this.Handle, this.thumbButtonPrev, this.thumbButtonNext); pictureBox1.Image = Properties.Resources.Thumb; pictureBox1_SizeChanged(this.pictureBox1, null); }
/// <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; } } } }
private void _Account_Changed(Account account) { Notifier notifier = _instances.Values.Where(o => o.Account.Guid == account.Guid).FirstOrDefault(); if (notifier != null) { notifier.Text = account.FullAddress; using (TabbedThumbnail thumb = _taskbarManager.TabbedThumbnail.GetThumbnailPreview(notifier.Handle)) { if (thumb != null) { thumb.Title = account.FullAddress; } } } this.InitJumpList(); this.UpdateJumpList(); this.CheckMail(); }
private void _Account_Changed(Account account) { Notifier notifier = _instances.Values.Where(o => o.AccountIndex == _config.Accounts.IndexOf(account)).FirstOrDefault(); if (notifier != null) { notifier.Text = account.FullAddress; TabbedThumbnail thumb = _taskbarManager.TabbedThumbnail.GetThumbnailPreview(notifier.Handle); if (thumb != null) { thumb.Title = account.FullAddress; } } this.BuildJumpList(); this.UpdateMailsJumpList(); this.CheckMail(); }
/// <summary> /// When a child tab updates its <see cref="Form.Icon"/> property, it should call this method to update the icon in the AeroPeek preview. /// </summary> /// <param name="tab">Tab whose icon was updated.</param> /// <param name="icon">The new icon to use. If this is left as null, we use <see cref="Form.Icon"/> on <paramref name="tab"/>.</param> public virtual void UpdateThumbnailPreviewIcon(TitleBarTab tab, Icon icon = null) { if (!AeroPeekEnabled) { return; } TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(tab.Content); if (preview == null) { return; } if (icon == null) { icon = tab.Content.Icon; } preview.SetWindowIcon((Icon)icon.Clone()); }
/// <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; }
internal void SetupThumbAndButtons() { _thumbForm = new ThumbForm(this); _thumb = new TabbedThumbnail(this.Handle, _thumbForm); _thumb.Title = _gmailClient.Username; _thumb.SetWindowIcon((Icon)this.Icon.Clone()); _thumb.TabbedThumbnailClosed += (sender, e) => { //ideally what i would like to here is cancel the close event //unfortunately it appears there is a bug in the WindowsAPICodePack which is not receiving any attention from Microsoft //the next best alternative is just to close the entire application, otherwise it will crash next time we try to update the thumbnail preview Close(); }; _thumbForm.Show(); _thumbForm.Render(); _prevButton = new ThumbnailToolBarButton(Properties.Resources.Previous, "Previous") { Enabled = false }; _openButton = new ThumbnailToolBarButton(Properties.Resources.Open, "Open") { Enabled = false }; _nextButton = new ThumbnailToolBarButton(Properties.Resources.Next, "Next") { Enabled = false }; _prevButton.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(PrevButtonClicked); _openButton.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(OpenButtonClicked); _nextButton.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(NextButtonClicked); TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(_thumb); TaskbarManager.Instance.ThumbnailToolBars.AddButtons(_thumbForm.Handle, _prevButton, _openButton, _nextButton); }
/// <summary> /// Create a new tab, add a webbrowser and navigate the given address/URL /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void button1_Click(object sender, System.EventArgs args) { TabPage newTab = new TabPage(comboBox1.Text); tabControl1.TabPages.Add(newTab); WebBrowser wb = new WebBrowser(); wb.DocumentTitleChanged += new EventHandler(wb_DocumentTitleChanged); wb.Navigated += new WebBrowserNavigatedEventHandler(wb_Navigated); wb.ProgressChanged += new WebBrowserProgressChangedEventHandler(wb_ProgressChanged); wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted); wb.Dock = DockStyle.Fill; wb.Navigate(comboBox1.Text); newTab.Controls.Add(wb); // Add thumbnail toolbar buttons TaskbarManager.Instance.ThumbnailToolBars.AddButtons(newTab.Handle, thumbButtonBack, thumbButtonForward, thumbButtonRefresh); // Add a new preview TabbedThumbnail preview = new TabbedThumbnail(this.Handle, newTab.Handle); // Event handlers for this preview preview.TabbedThumbnailActivated += preview_TabbedThumbnailActivated; preview.TabbedThumbnailClosed += preview_TabbedThumbnailClosed; preview.TabbedThumbnailMaximized += preview_TabbedThumbnailMaximized; preview.TabbedThumbnailMinimized += preview_TabbedThumbnailMinimized; TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview); // Select the tab in the application UI as well as taskbar tabbed thumbnail list tabControl1.SelectedTab = newTab; TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(tabControl1.SelectedTab); // set false for this new webbrowser scrollEventAdded = false; // button2.Enabled = true; }
private void button4_Click(object sender, EventArgs e) { // Clip the thumbnail when showing the thumbnail preview or aero peek // Only supported for RTF/Text files (as an example to show that we can do thumbnail clip // for specific windows if needed) if (tabControl1.SelectedTab == null) { return; } TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(tabControl1.SelectedTab); if (tabControl1.SelectedTab != null && preview != null) { RichTextBox rtbText = tabControl1.SelectedTab.Controls[0] as RichTextBox; if (button4.Text == clipText && rtbText != null) { preview.ClippingRectangle = GetClippingRectangle(rtbText); } else if (button4.Text == showFullText) { preview.ClippingRectangle = null; } } // toggle the text if (button4.Text == clipText) { button4.Text = showFullText; } else { button4.Text = clipText; } }