packages/Windows API Code Pack 1.1/source/Samples/Shell/TabbedThumbnailDemo/CS/Winforms/Form1.cs
/// <summary>
/// Create a new tab, add a webbrowser and navigate the given address/URL
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Create a new tab, add a webbrowser and navigate the given address/URL
Create a new tab add a webbrowser and navigate the given address / URL
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);
            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(newTab.Handle, thumbButtonBack, thumbButtonForward, thumbButtonRefresh);
            TabbedThumbnail preview = new TabbedThumbnail(this.Handle, newTab.Handle);
            preview.TabbedThumbnailActivated += preview_TabbedThumbnailActivated;
            preview.TabbedThumbnailClosed += preview_TabbedThumbnailClosed;
            preview.TabbedThumbnailMaximized += preview_TabbedThumbnailMaximized;
            preview.TabbedThumbnailMinimized += preview_TabbedThumbnailMinimized;
            TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview);
            tabControl1.SelectedTab = newTab;
            TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(tabControl1.SelectedTab);
            scrollEventAdded = false;
            button2.Enabled = true;
        }
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 ) ; TaskbarManager . Instance . ThumbnailToolBars . AddButtons ( newTab . Handle , thumbButtonBack , thumbButtonForward , thumbButtonRefresh ) ; TabbedThumbnail preview = new TabbedThumbnail ( this . Handle , newTab . Handle ) ; preview . TabbedThumbnailActivated += preview_TabbedThumbnailActivated ; preview . TabbedThumbnailClosed += preview_TabbedThumbnailClosed ; preview . TabbedThumbnailMaximized += preview_TabbedThumbnailMaximized ; preview . TabbedThumbnailMinimized += preview_TabbedThumbnailMinimized ; TaskbarManager . Instance . TabbedThumbnail . AddThumbnailPreview ( preview ) ; tabControl1 . SelectedTab = newTab ; TaskbarManager . Instance . TabbedThumbnail . SetActiveTab ( tabControl1 . SelectedTab ) ; scrollEventAdded = false ; button2 . Enabled = true ; }
Create a new tab, add a webbrowser and navigate the given address/URL
Create a new tab add a webbrowser and navigate the given address / URL
// Add thumbnail toolbar buttons // Add a new preview // Event handlers for this preview // Select the tab in the application UI as well as taskbar tabbed thumbnail list // set false for this new webbrowser //
sender
object
None
args
System.EventArgs
None