完整的窗体代码为:
<span style="font-size:18px;">using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show("你单击了"+tabControl1.SelectedTab.Text
//取消单击的选项卡标题
+"它的索引是"+tabControl1.SelectedIndex.ToString());//取消单击的选项卡索引
}
}
}
</span>
依次单击选项卡的运行结果为:
以上就是本文的全部内容,希望对大家的学习有所帮助。
注:相关教程知识阅读请移步到c#教程频道。












