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 WindowsForms01
{
public partial class TabControl01 : Form
{
public TabControl01()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
//자식역할
Button btn = new Button();
//할아버지 역할
this.tabControl1.TabPages[3].Controls.Add(btn);
//this.tabControl1.Controls.Add(btn);
}
private void button3_Click(object sender, EventArgs e)
{
//선택한 탭을 보여주기
//MessageBox.Show(tabControl1.SelectedIndex.ToString());
tabControl1.SelectedIndex = 1;
}
private void button4_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 1;
}
private void button5_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 2;
}
private void button6_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 3;
}
private void button7_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 0;
}
private void TabControl01_Load(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 1;
}
}
}