开发者

TabControl winform c#

开发者 https://www.devze.com 2023-01-31 19:50 出处:网络
Does anyone know why my tabcontrol will not display on this form? Have a feeling it maybe something simple but at the moment i just get a blank form.

Does anyone know why my tabcontrol will not display on this form? Have a feeling it maybe something simple but at the moment i just get a blank form.

Thanks

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace test_project_3
{
    public partial class TabTest : Form
    {
开发者_JAVA百科        public TabTest()
        {
            InitializeComponent();

            WebBrowser WB = new WebBrowser();
            WB.Navigate("www.google.com");

            TabControl tc = new TabControl();
            tc.Dock = DockStyle.Fill;
            tc.Show();

            TabPage tp = new TabPage();
            tp.Text = "test";
            tp.Show();
            tp.Controls.Add(WB);

            tc.TabPages.Add(tp);
        }
    }
}


You need to add the TabControl to the Controls collection:

this.Controls.Add(tc);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号