예제 #1
0
        public void NewPage(string newUrl, object req)
        {
            TabPage newPage = new TabPage(newUrl);

            tabControl1.TabPages.Add(newPage);
            tabControl1.SelectTab(newPage);
            CSharpBrowserSettings settings = new CSharpBrowserSettings();

            //settings.UserAgent = "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19";
            settings.CachePath = @"C:\temp\caches";
            ChromeWebBrowser browser = new ChromeWebBrowser();

            //browser.BrowserNewWindow += new NewWindowEventHandler(chromeWebBrowser1_BrowserNewWindow);
            //browser.BrowserTitleChange += new TitleChangeEventHandler(chromeWebBrowser1_BrowserTitleChange);
            browser.Initialize(settings);
            newPage.Controls.Add(browser);
            browser.Validate();
            browser.Dock = DockStyle.Fill;
            if (!newUrl.Contains("&"))
            {
                browser.OpenUrl(newUrl);
            }
            else
            {
                browser.OpenUrl(req);
            }
        }
예제 #2
0
        public BrowserTabPage(string URL, bool IsGoHome = false)
        {
            browser = new ChromeWebBrowser();
            InitializeComponent();
            this.browser.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(250)))), ((int)(((byte)(250)))));
            this.browser.Dock      = System.Windows.Forms.DockStyle.Fill;
            this.browser.Location  = new System.Drawing.Point(0, 0);
            this.browser.TabIndex  = 0;

            CSharpBrowserSettings settings = new CSharpBrowserSettings();

            //settings.UserAgent = "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19";
            settings.CachePath = @"C:\temp\caches";
            browser.Initialize(settings);
            this.Controls.Add(browser);
            browser.Validate();
            browser.Dock = DockStyle.Fill;
        }