コード例 #1
0
ファイル: Form1.cs プロジェクト: rokoucha/Wwing4
        private void newTabButton_Click(object sender, EventArgs e)
        {
            WebTabPage newTabPage = new WebTabPage("http://www.google.co.jp/", addressBox);

            tabControlEx1.TabPages.Add(newTabPage);
            PageNum++;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: atnanasi/Wwing4
 public Form1()
 {
     InitializeComponent();
     WebTabPage newTabPage = new WebTabPage("http://www.google.co.jp/",addressBox);
     tabControlEx1.TabPages.Add(newTabPage);
     PageNum ++;
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: rokoucha/Wwing4
        public Form1()
        {
            InitializeComponent();
            WebTabPage newTabPage = new WebTabPage("http://www.google.co.jp/", addressBox);

            tabControlEx1.TabPages.Add(newTabPage);
            PageNum++;
        }
コード例 #4
0
        protected override void OnDragOver(System.Windows.Forms.DragEventArgs e)
        {
            base.OnDragOver(e);

            Point pt = new Point(e.X, e.Y);

            //We need client coordinates.
            pt = PointToClient(pt);

            //Get the tab we are hovering over.
            WebTabPage hover_tab = (WebTabPage)GetTabPageByTab(pt);

            //Make sure we are on a tab.
            if (hover_tab != null)
            {
                //Make sure there is a TabPage being dragged.
                if (e.Data.GetDataPresent(typeof(WebTabPage)))
                {
                    e.Effect = DragDropEffects.Move;
                    WebTabPage drag_tab = (WebTabPage)e.Data.GetData(typeof(WebTabPage));

                    int item_drag_index     = FindIndex(drag_tab);
                    int drop_location_index = FindIndex(hover_tab);

                    //Don't do anything if we are hovering over ourself.
                    if (item_drag_index != drop_location_index)
                    {
                        ArrayList pages = new ArrayList();

                        //Put all tab pages into an array.
                        for (int i = 0; i < TabPages.Count; i++)
                        {
                            //Except the one we are dragging.
                            if (i != item_drag_index)
                            {
                                pages.Add(TabPages[i]);
                            }
                        }

                        //Now put the one we are dragging it at the proper location.
                        pages.Insert(drop_location_index, drag_tab);

                        //Make them all go away for a nanosec.
                        TabPages.Clear();

                        //Add them all back in.
                        TabPages.AddRange((WebTabPage[])pages.ToArray(typeof(WebTabPage)));

                        //Make sure the drag tab is selected.
                        SelectedTab = drag_tab;
                    }
                }
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }
コード例 #5
0
        /// <summary>
        /// Loops over all the TabPages to find the index of the given TabPage.
        /// </summary>
        /// <param name="page">The TabPage we want the index for.</param>
        /// <returns>The index of the given TabPage(-1 if it isn't found.)</returns>
        private int FindIndex(WebTabPage page)
        {
            for (int i = 0; i < TabPages.Count; i++)
            {
                if (TabPages[i] == page)
                {
                    return(i);
                }
            }

            return(-1);
        }
コード例 #6
0
        /// <summary>
        /// Finds the TabPage whose tab is contains the given point.
        /// </summary>
        /// <param name="pt">The point (given in client coordinates) to look for a TabPage.</param>
        /// <returns>The TabPage whose tab is at the given point (null if there isn't one).</returns>
        private TabPage GetTabPageByTab(Point pt)
        {
            WebTabPage tp = null;

            for (int i = 0; i < TabPages.Count; i++)
            {
                if (GetTabRect(i).Contains(pt))
                {
                    tp = (WebTabPage)TabPages[i];
                    break;
                }
            }

            return(tp);
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: rokoucha/Wwing4
        private void goButton_Click(object sender, EventArgs e)
        {
            string address = this.addressBox.Text;

            if (address.StartsWith("http://") || address.StartsWith("https://") || address.StartsWith("ftp://"))
            {
                WebTabPage openTabPage = (WebTabPage)tabControlEx1.SelectedTab;
                openTabPage.TabWebBrowser.Navigate(address);
            }
            else
            {
                WebTabPage openTabPage = (WebTabPage)tabControlEx1.SelectedTab;
                openTabPage.TabWebBrowser.Navigate("http://www.google.co.jp/search?q=" + address);
            }
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: rokoucha/Wwing4
 private void addressBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         string address = this.addressBox.Text;
         if (address.StartsWith("http://") || address.StartsWith("https://") || address.StartsWith("ftp://"))
         {
             WebTabPage openTabPage = (WebTabPage)tabControlEx1.SelectedTab;
             openTabPage.TabWebBrowser.Navigate(address);
         }
         else
         {
             WebTabPage openTabPage = (WebTabPage)tabControlEx1.SelectedTab;
             openTabPage.TabWebBrowser.Navigate("http://www.google.co.jp/search?q=" + address);
         }
     }
 }
コード例 #9
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (dragBoxFromMouseDown != Rectangle.Empty &&
                !dragBoxFromMouseDown.Contains(e.X, e.Y))
            {
                if (this.TabCount <= 1)
                {
                    return;
                }

                Point      pt = new Point(mouseDownPointX, mouseDownPointY);
                WebTabPage tp = (WebTabPage)GetTabPageByTab(pt);

                if (tp != null)
                {
                    DoDragDrop(tp, DragDropEffects.All);
                }
            }
        }
コード例 #10
0
ファイル: TabControlEx.cs プロジェクト: atnanasi/Wwing4
        /// <summary>
        /// Loops over all the TabPages to find the index of the given TabPage.
        /// </summary>
        /// <param name="page">The TabPage we want the index for.</param>
        /// <returns>The index of the given TabPage(-1 if it isn't found.)</returns>
        private int FindIndex(WebTabPage page)
        {
            for (int i = 0; i < TabPages.Count; i++)
            {
                if (TabPages[i] == page)
                    return i;
            }

            return -1;
        }
コード例 #11
0
ファイル: Form1.cs プロジェクト: atnanasi/Wwing4
 private void newTabButton_Click(object sender, EventArgs e)
 {
     WebTabPage newTabPage = new WebTabPage("http://www.google.co.jp/",addressBox);
     tabControlEx1.TabPages.Add(newTabPage);
     PageNum++;
 }
コード例 #12
0
ファイル: Form1.cs プロジェクト: rokoucha/Wwing4
        private void stopButton_Click(object sender, EventArgs e)
        {
            WebTabPage openTabPage = (WebTabPage)tabControlEx1.SelectedTab;

            openTabPage.TabWebBrowser.Stop();
        }
コード例 #13
0
ファイル: Form1.cs プロジェクト: rokoucha/Wwing4
        private void reloadButton_Click(object sender, EventArgs e)
        {
            WebTabPage openTabPage = (WebTabPage)tabControlEx1.SelectedTab;

            openTabPage.TabWebBrowser.Refresh();
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: rokoucha/Wwing4
        private void nextButton_Click(object sender, EventArgs e)
        {
            WebTabPage openTabPage = (WebTabPage)tabControlEx1.SelectedTab;

            openTabPage.TabWebBrowser.GoForward();
        }