Form attch to tabControl 카테고리 없음2015. 3. 28. 14:57
void addTabPage(string pageName)
{
TabPage tabPage = new System.Windows.Forms.TabPage();
tabPage.Paint += new PaintEventHandler(tabPage_Paint);
tabPage.Name = pageName;
tabPage.Text = pageName;
tabPage.AutoScroll = true;
Point location = new Point(0, 0);
for(int i = 0 ;i < 2; i++)
addForm(tabPage, ref location);
this.myTabControl.Controls.Add(tabPage);
}
void addForm(TabPage tabPage, ref Point location)
{
Form1 f = new Form1();
f.Location = location;
f.Size = new Size(this.tabPage1.ClientRectangle.Size.Width-5,this.tabPage1.ClientRectangle.Size.Height-5);
f.BackColor = Color.Black;
location.Y = f.ClientRectangle.Height + 5;
f.TopLevel = false;
f.FormBorderStyle = FormBorderStyle.None;
//f.Dock = DockStyle.Fill;
tabPage.Controls.Add(f);
f.Visible = true;
}
tabControl 스크롤 하면 MDI폼의 Graphic 객체가 무효화되지 않는다.
r