Ejemplo n.º 1
0
        private void toolsToolStripDropDownButton_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ToolStripMenuItem menuItem = e.ClickedItem as ToolStripMenuItem;

            if (menuItem != null && menuItem.DropDownItems.Count == 0)
            {
                toolsToolStripDropDownButton.HideDropDown();
            }

            WebBrowserTabPage webBrowserTabPage = mainTabControl.SelectedTab as WebBrowserTabPage;

            if (webBrowserTabPage != null)
            {
                if (e.ClickedItem == importExportToolStripMenuItem)
                {
                    WinAPIHelper.InvokeCommandByMessage(1, WinAPIHelper.Messages.ID_IE_FILE_IMPORTEXPORT, webBrowserTabPage);
                }
                else if (e.ClickedItem == optionsToolStripMenuItem)
                {
                    WinAPIHelper.InvokeCommandByMessage(2, WinAPIHelper.Messages.ID_IE_VIEW_OPTIONS, webBrowserTabPage);
                }
                else if (e.ClickedItem == aboutToolStripMenuItem)
                {
                    using (AboutBox aboutBox = new AboutBox(webBrowserTabPage))
                    {
                        aboutBox.ShowDialog(this);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void favoritesToolStripSpiltButton_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ToolStripMenuItem menuItem = e.ClickedItem as ToolStripMenuItem;

            if (menuItem != null && menuItem.DropDownItems.Count == 0)
            {
                favoritesToolStripSpiltButton.HideDropDown();
            }

            WebBrowserTabPage webBrowserTabPage = mainTabControl.SelectedTab as WebBrowserTabPage;

            if (webBrowserTabPage != null)
            {
                if (e.ClickedItem == addToFavoritesToolStripMenuItem)
                {
                    WinAPIHelper.InvokeCommandByMessage(2, WinAPIHelper.Messages.ID_IE_CONTEXTMENU_ADDFAV, webBrowserTabPage);
                }
                else if (e.ClickedItem == organizeFavoritesToolStripMenuItem)
                {
                    Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Favorites));
                }
                else if (e.ClickedItem.Tag != null)
                {
                    urlToolStripComboBox.Text = e.ClickedItem.Tag.ToString();

                    webBrowserTabPage.Navigate(urlToolStripComboBox.Text, true);
                }
            }
        }
Ejemplo n.º 3
0
        private void pageToolStripDropDownButton_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ToolStripMenuItem menuItem = e.ClickedItem as ToolStripMenuItem;

            if (menuItem != null && menuItem.DropDownItems.Count == 0)
            {
                pageToolStripDropDownButton.HideDropDown();
            }

            WebBrowserTabPage webBrowserTabPage = mainTabControl.SelectedTab as WebBrowserTabPage;

            if (webBrowserTabPage != null)
            {
                if (e.ClickedItem == findToolStripMenuItem)
                {
                    WinAPIHelper.InvokeCommandByMessage(2, WinAPIHelper.Messages.ID_IE_EDIT_FIND, webBrowserTabPage);
                }
                else if (e.ClickedItem == saveAsToolStripMenuItem)
                {
                    webBrowserTabPage.Browser.ShowSaveAsDialog();
                }
                else if (e.ClickedItem == desktopShortcutToolStripMenuItem)
                {
                    WinAPIHelper.InvokeCommandByMessage(1, WinAPIHelper.Messages.ID_IE_FILE_SENDDESKTOPSHORTCUT, webBrowserTabPage);

                    MessageBox.Show(this, String.Format("The shortcut of the following page has been created on desktop:{0}{0}{1}", Environment.NewLine, webBrowserTabPage.Title), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (e.ClickedItem == printToolStripMenuItem)
                {
                    webBrowserTabPage.Browser.ShowPrintDialog();
                }
                else if (e.ClickedItem == printPreviewToolStripMenuItem)
                {
                    webBrowserTabPage.Browser.ShowPrintPreviewDialog();
                }
                else if (e.ClickedItem == pageSetupToolStripMenuItem)
                {
                    webBrowserTabPage.Browser.ShowPageSetupDialog();
                }
                else if (e.ClickedItem == viewSourceToolStripMenuItem)
                {
                    WinAPIHelper.InvokeCommandByMessage(2, WinAPIHelper.Messages.ID_IE_CONTEXTMENU_VIEWSOURCE, webBrowserTabPage);
                }
            }
        }