Event args for when close is selected on a tabbed thumbnail proxy window.
Inheritance: TabbedThumbnailEventArgs
コード例 #1
0
        private TabbedThumbnailClosedEventArgs GetTabbedThumbnailClosingEventArgs()
        {
            TabbedThumbnailClosedEventArgs eventArgs = null;

            if (this.WindowHandle != IntPtr.Zero)
            {
                eventArgs = new TabbedThumbnailClosedEventArgs(this.WindowHandle);
            }
            else if (this.WindowsControl != null)
            {
                eventArgs = new TabbedThumbnailClosedEventArgs(this.WindowsControl);
            }

            return(eventArgs);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: QuocHuy7a10/Arianrhod
        void preview_TabbedThumbnailClosed(object sender, TabbedThumbnailClosedEventArgs e)
        {

            TabPage pageClosed = null;

            // Find the tabpage that was "closed" by the user (via the taskbar tabbed thumbnail)
            foreach (TabPage page in tabControl1.TabPages)
            {
                if (page.Handle == e.WindowHandle)
                {
                    pageClosed = page;
                    break;
                }
            }

            if (pageClosed != null)
            {
                // Remove the event handlers
                WebBrowser wb = pageClosed.Controls[0] as WebBrowser;

                if (wb != null)
                {
                    wb.DocumentTitleChanged -= new EventHandler(wb_DocumentTitleChanged);
                    //wb.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
                    wb.Navigated -= new WebBrowserNavigatedEventHandler(wb_Navigated);
                    wb.ProgressChanged -= new WebBrowserProgressChangedEventHandler(wb_ProgressChanged);
                    wb.Document.Window.Scroll -= new HtmlElementEventHandler(Window_Scroll);

                    wb.Dispose();
                }
                else
                {
                    // It's most likely a RichTextBox.

                    RichTextBox rtbText = pageClosed.Controls[0] as RichTextBox;

                    if (rtbText != null)
                    {
                        rtbText.KeyDown -= new KeyEventHandler(rtbText_KeyDown);
                        rtbText.MouseMove -= new MouseEventHandler(rtbText_MouseMove);
                        rtbText.KeyUp -= new KeyEventHandler(rtbText_KeyUp);
                    }

                    rtbText.Dispose();
                }

                // Finally, remove the tab from our UI
                if (pageClosed != null)
                    tabControl1.TabPages.Remove(pageClosed);

                // Dispose the tab
                pageClosed.Dispose();

                if (tabControl1.TabPages.Count > 0)
                    button2.Enabled = true;
                else
                    button2.Enabled = false;
            }

            TabbedThumbnail tabbedThumbnail = sender as TabbedThumbnail;
            if (tabbedThumbnail != null)
            {
                // Remove the event handlers from the tab preview
                tabbedThumbnail.TabbedThumbnailActivated -= (preview_TabbedThumbnailActivated);
                tabbedThumbnail.TabbedThumbnailClosed -= (preview_TabbedThumbnailClosed);
                tabbedThumbnail.TabbedThumbnailMaximized -= (preview_TabbedThumbnailMaximized);
                tabbedThumbnail.TabbedThumbnailMinimized -= (preview_TabbedThumbnailMinimized);
            }
        }
コード例 #3
0
        private TabbedThumbnailClosedEventArgs GetTabbedThumbnailClosingEventArgs()
        {
            TabbedThumbnailClosedEventArgs eventArgs = null;

            if (this.WindowHandle != IntPtr.Zero)
            {
                eventArgs = new TabbedThumbnailClosedEventArgs(this.WindowHandle);
            }
            else if (this.WindowsControl != null)
            {
                eventArgs = new TabbedThumbnailClosedEventArgs(this.WindowsControl);
            }

            return eventArgs;
        }