TabControl控件

        private void Form1_Load(object sender, EventArgs e)
{
#region 显示样式
tabControl1.ImageList = imageList1;
tabControl1.Appearance=TabAppearance.FlatButtons;//
tabPage1.ImageIndex = ;
tabPage1.Text = "郑州";
tabPage1.Tag = ; tabPage2.ImageKey = "2.jpg";
tabPage2.Text = "信阳";
//MessageBox.Show(tabPage1.Tag.ToString());
#endregion
} private void button1_Click(object sender, EventArgs e)
{
string title = "新增选项卡" + (tabControl1.TabCount + ).ToString();
TabPage myTabPage=new TabPage(title);
tabControl1.TabPages.Add(title);
//MessageBox.Show("现有"+tabControl1.TabCount+"个选项卡");
} private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
//获取选中选项卡的名称
string strTabPageName = tabControl1.SelectedTab.Text;
//MessageBox.Show("你选择的选项卡为"+strTabPageName);
} private void button2_Click(object sender, EventArgs e)
{
tabControl1.TabPages.Remove(tabControl1.SelectedTab);
//MessageBox.Show("你删除的选项卡为"+tabControl1.SelectedTab.Text);
}

MSDNhttp://msdn.microsoft.com/zh-cn/library/system.windows.controls.tabcontrol.aspx

上一篇:jQuery.FlexiGrid使用总结


下一篇:Phonegap 自定义插件