Пример #1
0
        void FormMain_BrowStaChanged(object sender, BrowserStaChangeArgs e)
        {
            switch (e.Command)
            {
            case BrowSTACommand.NewWindow:
                NewTabWindow(e);
                break;

            case BrowSTACommand.TitleChanged:
                TabPageTitleChange(e);
                break;

            default:
                break;
            }
        }
Пример #2
0
        private void TabPageTitleChange(BrowserStaChangeArgs e)
        {
            var webview = Utils.BrowserController.GetWebViewByGUID(e.TarTabUid);
            var list    = this.customTabControl1.TabPages;

            foreach (TabPage p in list)
            {
                if (p.Controls.Contains(webview) && this.customTabControl1.SelectedTab == p)
                {
                    var title = e.Tag.ToString();
                    p.Text        = title.Length < 10 ? title : title.Substring(0, 10) + "..";
                    this.Text     = title;
                    p.ToolTipText = title;
                    break;
                }
            }
        }
Пример #3
0
        private void NewTabWindow(BrowserStaChangeArgs e)
        {
            TabPage tp = new TabPage("New Window");

            tp.BorderStyle = BorderStyle.FixedSingle;
            tp.BackColor   = System.Drawing.Color.WhiteSmoke;
            this.customTabControl1.TabPages.Add(tp);//.Insert(this.customTabControl1.TabPages.Count - 1, tp);
            this.customTabControl1.TabPages.RemoveAt(this.customTabControl1.TabPages.Count - 2);
            CreateNewStarTab();
            this.customTabControl1.SelectedTab = tp;
            var webView = (UIs.ucBrowserView)e.Tag;

            if (webView != null)
            {
                webView.Dock = DockStyle.Fill;
                tp.Controls.Add(webView);
                tp.Tag = webView.BrowserUniqueID;
            }
        }