public void Stage_tabPage_Reset(TabControl tabControl_Stage_control_parameter, NierMainForm Form_parameter) { string[] TabPage_name_comb = new string[4]; TabPage_name_comb[0] = "Sampling"; TabPage_name_comb[1] = "Cooling"; TabPage_name_comb[2] = "Scan"; TabPage_name_comb[3] = "Empty"; TabPage[] TabPage_comb = new TabPage[4]; for (int i = 0; i < 4; i++) { TabPage_comb[i] = new TabPage(TabPage_name_comb[i]); TabPage_comb[i].BackColor = Color.White; } tabControl_Stage_control_parameter.TabPages.Clear(); tabControl_Stage_control_parameter.TabPages.AddRange(TabPage_comb); for (int i = 0; i < 4; i++) { Stage_WinForm stage_WinForm = new Stage_WinForm(Form_parameter, TabPage_name_comb[i]); stage_WinForm.TopLevel = false; stage_WinForm.Show(); TabPage_comb[i].Controls.Add(stage_WinForm); } tabControl_Stage_control_parameter.SelectTab(0); }
时间: 2024-02-14 19:33:32 浏览: 134
B_TabControl_B_TabControl.rar_
这段代码的作用是重置一个TabControl的Tab页,并在每个Tab页中添加一个名为Stage_WinForm的窗体控件。具体来说,它首先创建一个包含4个字符串的字符串数组TabPage_name_comb,然后创建一个包含4个TabPage对象的TabPage数组TabPage_comb。接下来,它通过循环为每个TabPage对象设置背景颜色,并将这些TabPage对象添加到TabControl的TabPages集合中,以此来重置TabControl的Tab页。然后,它再次循环,对于每个TabPage对象,创建一个Stage_WinForm窗体控件,并将其添加到TabPage对象的Controls集合中。最后,它选中TabControl的第一个Tab页。
阅读全文