TabControl 控件是由System.Windows.Forms.TabControl類提供的,作用就是講相關的組件組合到一系列選項卡頁面上。
MulitiLine 屬性用來設置是否顯示多行選項卡。如果false,而又多個選項卡不能一次顯示出來,就提供組箭頭查看剩余的選項卡
Appearance 屬性是指示選項卡是繪制成按鈕還是繪制成常規的選項卡,該屬性有三個值分別是:Normal(繪制成常規選項)、Buttons(繪制成常規按鈕)、FlatButtons(繪制成平滑按鈕)
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 TabControl_選項卡控件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
string b = tabControl1.SelectedTab.Text; //獲取tabcontrol1.選擇后的tab的text
string a = tabControl1.SelectedIndex.ToString() ; //獲取 tabcontrol.選擇后索引值
MessageBox.Show("您點擊了"+b+"\n"+"索引值是"+a);
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
