/// <summary>
        /// 根据某个url添加界面
        /// </summary>
        /// <param name="url"></param>
        /// <param name="insertIndex"></param>
        private void AddTab(CSharpBrowserSettings setting, int? insertIndex = null)
        {
            browerTabControl.SuspendLayout();

            var brower = new UserControl1(initSetting)
            {
                Dock = DockStyle.Fill,
            };

            var tabPage = new TabPage(setting.DefaultUrl)
            {
                Dock = DockStyle.Fill
            };

            brower.CreateControl();
            tabPage.Controls.Add(brower);

            if (insertIndex == null)
            {
                browerTabControl.TabPages.Add(tabPage);
            }
            else
            {
                browerTabControl.TabPages.Insert(insertIndex.Value, tabPage);
            }

            browerTabControl.SelectedTab = tabPage;
            browerTabControl.ResumeLayout(true);
        }
Esempio n. 2
0
        public UserControl1(CSharpBrowserSettings settings)
        {

            InitializeComponent();
            thisChrome = new ChromeWebBrowser();
            thisChrome.Initialize(settings);
            panel1.Controls.Add(thisChrome);
            thisChrome.Validate();
            thisChrome.Dock = DockStyle.Fill;
  
        }
 public int Initialize(CSharpBrowserSettings settings)
 {
     browserSettings = settings;
     return Initialize();
 }
 private void BrowerForm_Load(object sender, EventArgs e)
 {
     initSetting = new CSharpBrowserSettings();
     initSetting.DefaultUrl = System.IO.Directory.GetCurrentDirectory() + "\\TestHtml\\test.html";
     initSetting.CachePath = @"C:\temp\caches";
     AddTab(initSetting);
 }
 public ChromeWebBrowser(CSharpBrowserSettings settings) : this()
 {
     browserSettings = settings;
     Initialize();
 }