public void AddItem(TabPage tabPage) { //1. store in collection tabPageCollection.Add(tabPage); tabPage.OwnerContainer = this; if (pnode != null) { if (currentPage == null) { currentPage = tabPage; //add tab button into list this.tabTitleList.AddChild(tabPage.GetTitleNode(pnode)); //add page body contentNode.AddChild(tabPage.GetPageBody(pnode)); } else { //add tab button into list this.tabTitleList.AddChild(tabPage.GetTitleNode(pnode)); } } }