/// <summary> /// 设置当前活动的<see cref="RelaxedTabPage"/>对象。 /// </summary> /// <param name="tabPage">要设置活动的<see cref="RelaxedTabPage"/>对象</param> public void SetActiveTabPage(RelaxedTabPage tabPage) { int index = this.TabPages.IndexOf(tabPage); if (index < 0) { throw new HttpException(string.Format("在RelaxedTabStrip:{1}中没有找到RelaxedTabPage:{0}", new object[] { (tabPage == null) ? "null" : tabPage.ID, this.ID })); } this.ActiveTabPageIndex = index; }
/// <summary> /// 获取当前活动的<see cref="RelaxedTabPage"/> /// </summary> /// <returns></returns> public RelaxedTabPage GetActivePage() { int activeTabPageIndex = this.ActiveTabPageIndex; if (activeTabPageIndex >= this.TabPages.Count) { throw new Exception("活动页索引超出范围"); } if (activeTabPageIndex < 0) { return(null); } RelaxedTabPage tabPage = this.TabPages[activeTabPageIndex]; return(tabPage); }
private void RenderAllTabs(SchemaObjectBase data, Scene currentScene) { string defaultKey = string.Empty; // this.tabStrip.SelectedKey; Dictionary<string, SchemaPropertyValueCollection> tabGroup = data.Properties.GroupByTab(); this.tabStrip.TabPages.Clear(); foreach (SchemaTabDefine tab in data.Schema.Tabs) { SchemaPropertyValueCollection properties = null; if (tabGroup.TryGetValue(tab.Name, out properties) == false) properties = new SchemaPropertyValueCollection(); Control panel = this.RenderOnePanel(tab, properties, currentScene); RelaxedTabPage item = new RelaxedTabPage() { Title = tab.Description, }; item.Controls.Add(panel); this.tabStrip.TabPages.Add(item); } if (this.tabStrip.TabPages.Count > 0) { this.tabStrip.ActiveTabPageIndex = 0; } }
private void RenderTabs(HashSet<string> schemaTypes, SchemaPropertyValueCollection propertyValues, HashSet<string> tabNames) { if (tabNames.Count > 0) { var tabs = ObjectSchemaSettings.GetConfig().Schemas[schemaTypes.First()].Tabs; foreach (string item in tabNames) { RelaxedTabPage tabPage = new RelaxedTabPage() { Title = tabs[item].Description, TagKey = item }; this.tabs.TabPages.Add(tabPage); PropertyForm pForm = new PropertyForm() { AutoSaveClientState = false }; pForm.ID = tabPage.TagKey + "_Form"; pForm.ReadOnly = this.EditEnabled == false; //// if (currentScene.Items[this.tabStrip.ID].Recursive == true) //// pForm.ReadOnly = currentScene.Items[this.tabStrip.ID].ReadOnly; var pageValues = TabGroup(propertyValues, item).ToPropertyValues(); pForm.Properties.CopyFrom(pageValues); pForm.ShowCheckBoxes = true; PropertyLayoutSectionCollection layouts = new PropertyLayoutSectionCollection(); layouts.LoadLayoutSectionFromConfiguration("DefalutLayout"); pForm.Layouts.InitFromLayoutSectionCollection(layouts); pForm.Style["width"] = "100%"; pForm.Style["height"] = "400"; tabPage.Controls.Add(pForm); } this.tabs.ActiveTabPageIndex = 0; } }
private Control RenderOnePanel(SchemaTabDefine tab, SchemaPropertyValueCollection properties, bool readOnly) { RelaxedTabPage tabPage = new RelaxedTabPage() { Title = tab.Description, TagKey = tab.Name }; this.tabs.TabPages.Add(tabPage); PropertyForm pForm = new PropertyForm() { AutoSaveClientState = false }; pForm.ID = tab.Name + "_Form"; //// if (currentScene.Items[this.tabStrip.ID].Recursive == true) //// pForm.ReadOnly = currentScene.Items[this.tabStrip.ID].ReadOnly; pForm.Properties.CopyFrom(properties.ToPropertyValues()); PropertyLayoutSectionCollection layouts = new PropertyLayoutSectionCollection(); layouts.LoadLayoutSectionFromConfiguration("DefalutLayout"); pForm.Layouts.InitFromLayoutSectionCollection(layouts); pForm.Style["width"] = "100%"; pForm.Style["height"] = "400"; tabPage.Controls.Add(pForm); pForm.ReadOnly = readOnly; return tabPage; }
/// <summary> /// 设置当前活动的<see cref="RelaxedTabPage"/>对象。 /// </summary> /// <param name="tabPage">要设置活动的<see cref="RelaxedTabPage"/>对象</param> public void SetActiveTabPage(RelaxedTabPage tabPage) { int index = this.TabPages.IndexOf(tabPage); if (index < 0) { throw new HttpException(string.Format("在RelaxedTabStrip:{1}中没有找到RelaxedTabPage:{0}", new object[] { (tabPage == null) ? "null" : tabPage.ID, this.ID })); } this.ActiveTabPageIndex = index; }