public void RemoveBar(TSNavBarItem item) { int index = item.BarIndex; _navBarItems.Remove(item); Controls.Remove(item); SetLayout(); }
public void SetLayout(TSNavBarItem item) { this.SuspendLayout(); this.Controls.Add(item); if (_navBarItems.Count == 0) { item.Top = this.Top; } else { item.Top = this[_navBarItems.Count - 1].Bottom + _barSpace; } item.Height = item.TitleHeight; item.Width = this.Width; //other process this.ResumeLayout(); }
private void MainForm_Load(object sender, System.EventArgs e) { //Set the user name into the statuslabel var user = LoginManager.Instance.GetUser(); if (user != null) { this.tsslUser.Text = user.Name; } int userId = LoginManager.Instance.GetUserId(); //load the navbar in the left panel var nodes = ConfigManager.Instance.GetNavbarConfig().BarDataList; var validNodes = GetValidNavItems(userId, nodes); if (validNodes != null) { foreach (var node in validNodes) { if (_permissionManager.HasFeaturePermission(userId, node.Id, Model.Permission.PermissionMask.View)) { Controls.TSNavBarItem tsNavBarItem = _navBarContainer.AddBar(); tsNavBarItem.Title = node.Title; //tsNavBarItem.Dock = DockStyle.Top; tsNavBarItem.AddTreeNode(node.Children); tsNavBarItem.TreeView.NodeCollapseImage = _imageList.Images[0]; tsNavBarItem.TreeView.NodeExpandedImage = _imageList.Images[1]; tsNavBarItem.TreeView.NodeImage = _imageList.Images[2]; } } //Set the default expand const int index = 0; string featureId = string.Empty; if (validNodes.Count > 0 && validNodes[index].Children != null && validNodes[index].Children.Count > 0) { featureId = validNodes[index].Children[0].Id; _navBarContainer.ExpandDefaultBar(index); FormManager.Instance.ActiveForm(this, _panelMain, featureId, _gridConfig, UFXBLLManager.Instance); } } }