public void add_stats(TableLayoutPanel table) { TabControl stats_tab = table.Controls.Find("stats_tab", true)[0] as TabControl; stats_page sp = new stats_page(); stats_tab.TabPages.Add(sp.stats_tab.SelectedTab); stats_tab.SelectedIndex = stats_tab.TabPages.Count - 1; stats_tab.SelectedTab.Text = stats_tab.TabPages.Count + ""; }
private void InitUISettings() { MaximumSize = Size; //创建反射所需对象 object target_class_instance = Activator.CreateInstance(target_class); var target_type = typeof(EntityComponentsManager); min_box.KeyPress += Number_KeyPress; max_box.KeyPress += Number_KeyPress; set_absolute.Click += SetDistance; set_horizontal.Click += SetDistance; set_x.Click += SetDistance; set_y.Click += SetDistance; set_z.Click += SetDistance; set_cat_type.Click += SetButtonTag; set_cat_type.Click += ClickSound; set_nbt.Click += SetButtonTag; set_nbt.Click += ClickSound; gamemode_box.KeyDown += CanNotInput; effect_page efp = new effect_page(); effect_tab.TabPages.Add(efp.effect_tab.SelectedTab); adv_page advP = new adv_page(); adv_tab.TabPages.Add(advP.adv_tab.SelectedTab); stats_page statsP = new stats_page(); stats_tab.TabPages.Add(statsP.stats_tab.SelectedTab); foreach (ToolStripMenuItem item in entity_property_title_menu.Items) { item.BackgroundImage = btn_img; item.BackgroundImageLayout = ImageLayout.Stretch; item.ForeColor = Color.White; item.Click += ClickSound; foreach (ToolStripMenuItem subitem in item.DropDownItems) { subitem.BackgroundImage = btn_img; subitem.BackgroundImageLayout = ImageLayout.Stretch; subitem.ForeColor = Color.White; foreach (ToolStripMenuItem subsubitem in subitem.DropDownItems) { subsubitem.BackgroundImage = btn_img; subsubitem.BackgroundImageLayout = ImageLayout.Stretch; subsubitem.ForeColor = Color.White; ToolStripMenuItem parentItem = subsubitem.OwnerItem as ToolStripMenuItem; ToolStripMenuItem parentparentItem = parentItem.OwnerItem as ToolStripMenuItem; int parentIndex = parentparentItem.DropDownItems.IndexOf(parentItem); int currentIndex = parentItem.DropDownItems.IndexOf(subsubitem); subsubitem.Click += (a, b) => { target_type.InvokeMember(component_manager[parentIndex * 3 + currentIndex].Name, BindingFlags.InvokeMethod, null, target_class_instance, new object[] { table }); }; } } } TreeView Root = Cbhk_form.register; entity_type.AutoCompleteMode = AutoCompleteMode.Suggest; entity_type.AutoCompleteSource = AutoCompleteSource.CustomSource; foreach (TreeNode item in Root.Nodes) { if (item.Text == "minecraft:entity_type") { foreach (TreeNode subitem in item.Nodes) { if (subitem.Text == "entries") { foreach (TreeNode subsubitem in subitem.Nodes) { entity_type.Items.Add(subsubitem.Text); entity_type.AutoCompleteCustomSource.Add(subsubitem.Text.Replace("minecraft:", "")); } } } } } }