我在用C#开发WIN FORM的时候,在一个窗体上用到了tabControl控件,在这个tabControl上建了5个页签,分别为PgMiscItem,PgLend,PgReturn,PgImport,this.PgScrap。排列顺序也是这样的,可不知为什么每次我关掉这个窗体,再打开时,页签的排列顺序会乱掉。在InitializeComponent()里的tabControl.Add顺序也乱了!后来我写了个方法:
private void tabSort()
{
tabCtrls.Controls.SetChildIndex(this.PgMiscItem,0);
tabCtrls.Controls.SetChildIndex(this.PgLend,1);
tabCtrls.Controls.SetChildIndex(this.PgReturn,2);
tabCtrls.Controls.SetChildIndex(this.PgImport,3);
tabCtrls.Controls.SetChildIndex(this.PgScrap,4);
}
并把这个方法放在InitializeComponent()事件下面,可还是没用!
难道我每次打开页面的时候,都要重写tabControl.Add吗?有哪位大哥知道的话,请告诉小弟吧!先谢过了!