private void InitializeModuleMaster() { try { ICollection <ModuleIndex> moduleIndexs = this.moduleAPIs.GetModuleIndexes(); foreach (ModuleIndex moduleIndex in moduleIndexs) { if (moduleIndex.ModuleID == 1 || moduleIndex.ModuleID == 6 || moduleIndex.ModuleID == 9) { NaviBand naviBand = new NaviBand(); naviBand.Text = moduleIndex.Code; naviBand.Tag = moduleIndex.ModuleID.ToString(); naviBand.SmallImage = this.imageListModuleMasterSmall.Images[moduleIndex.ModuleID == 1 ? 0 : (moduleIndex.ModuleID == 6 ? 1 : 2)]; naviBand.LargeImage = this.imageListModuleMasterLarge.Images[moduleIndex.ModuleID == 1 ? 0 : (moduleIndex.ModuleID == 6 ? 1 : 2)]; this.naviBarModuleMaster.Bands.Add(naviBand); } } this.naviBarModuleMaster.VisibleLargeButtons = this.naviBarModuleMaster.Bands.Count; } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
public void InitNaviBar() { IList <TreeView> treeviewlist = new List <TreeView>(); int i = 0; foreach (FunctionAllVo fvo in functionalllist) { NaviBand band = new NaviBand(); //TreeView treeView1 = new System.Windows.Forms.TreeView(); //treeviewlist.Add(treeView1); band.Text = fvo.Catalogname; band.SmallImage = (Image)Properties.Resources.ResourceManager.GetObject(fvo.Catalogimage + "16"); band.LargeImage = (Image)Properties.Resources.ResourceManager.GetObject(fvo.Catalogimage + "24"); band.Tag = i; //band.Click += new EventHandler(band_Click); InitTreeView(band, fvo.Functionlist); naviBar.Bands.Add(band); i++; } naviBar.ActiveBandChanging += new NaviBandEventHandler(naviBar_ActiveBandChanged); }
private void naviBarModuleMaster_ActiveBandChanged(object sender, EventArgs e) { try { int moduleID; if (int.TryParse(this.naviBarModuleMaster.ActiveBand.Tag.ToString(), out moduleID)) { if (moduleID == 9) { this.OpenModuleDetail((int)GlobalEnums.NmvnTaskID.Reports); if (lastActiveBand != null) { this.naviBarModuleMaster.ActiveBand = lastActiveBand; } } else { this.buttonNaviBarHeader.Text = this.naviBarModuleMaster.ActiveBand.Text; this.fastNMVNTask.Parent = null; this.naviBarModuleMaster.ActiveBand.ClientArea.Controls.Add(this.fastNMVNTask); this.fastNMVNTask.Dock = DockStyle.Fill; this.fastNMVNTask.Visible = true; lastActiveBand = this.naviBarModuleMaster.ActiveBand; InitializeTaskMaster(moduleID); } } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void InitializeModuleMaster() { try { ICollection <ModuleIndex> moduleIndexs = this.moduleAPIs.GetModuleIndexes(); foreach (ModuleIndex moduleIndex in moduleIndexs) { if (moduleIndex.ModuleID != 8) { NaviBand naviBand = new NaviBand(); naviBand.Text = moduleIndex.Code; naviBand.Tag = moduleIndex.ModuleID.ToString(); naviBand.SmallImage = this.imageListModuleMasterSmall.Images[moduleIndex.ModuleID <= 9 ? moduleIndex.ModuleID : 8]; naviBand.LargeImage = this.imageListModuleMasterLarge.Images[moduleIndex.ModuleID <= 9 ? moduleIndex.ModuleID : 8]; this.naviBarModuleMaster.Bands.Add(naviBand); } } this.naviBarModuleMaster.VisibleLargeButtons = this.naviBarModuleMaster.Bands.Count; this.naviBarModuleMaster.PopupHeight = this.naviBarModuleMaster.Height + this.naviBarModuleMaster.HeaderHeight - (this.naviBarModuleMaster.ButtonHeight) * this.naviBarModuleMaster.Bands.Count - 15; } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void AddBandVerbClicked(object sender, EventArgs e) { NaviBand band = host.CreateComponent(typeof(NaviBand)) as NaviBand; if (band != null) { designingControl.Controls.Add(band); } }
/// <summary> /// Adds a new NaviBand the the collection /// </summary> /// <param name="value">The new NaviBand to add</param> /// <exception cref="ArgumentNullExceptions">Raised when the band argument is null</exception> public int Add(NaviBand value) { int result = innerList.Add(value); owner.Controls.Add(value); owner.Controls.SetChildIndex(value, result); value.OriginalOrder = result; return(result); }
/// <summary> /// Removes a band from the collection of bands /// </summary> /// <param name="band">The band to remove</param> /// <exception cref="ArgumentNullExceptions">Raised when the band argument is null</exception> public void Remove(NaviBand value) { innerList.Remove(value); owner.Controls.Remove(value); if (owner.Controls.Contains(value.Button)) { owner.Controls.Remove(value.Button); } }
public override void Initialize(System.ComponentModel.IComponent component) { base.Initialize(component); if (component is NaviBand) { designingComponent = (NaviBand)component; EnableDesignMode(designingComponent.ClientArea, "ClientArea"); } }
/// <summary> /// Creates a new instance of the NaviBar component with design time support /// </summary> /// <param name="host">The controls host</param> /// <returns>The newly created component</returns> protected override IComponent[] CreateComponentsCore(IDesignerHost host) { // Create the control NaviBar naviBarCtrl = (NaviBar)host.CreateComponent(typeof(NaviBar)); NaviBand naviBandCtrl = (NaviBand)host.CreateComponent(typeof(NaviBand)); // Add a new button naviBarCtrl.Controls.Add(naviBandCtrl); return(new IComponent[] { naviBarCtrl }); }
public int Compare(object x, object y) { if (!(x is NaviBand) || !(y is NaviBand)) { throw new ArgumentException("Both of the argument should be of type NaviBand"); } NaviBand bandx = (NaviBand)x; NaviBand bandy = (NaviBand)y; return(bandx.Order.CompareTo(bandy.Order)); }
private void ButtonAddBand_Click(object sender, EventArgs e) { naviBar1.SuspendLayout(); NaviBand band = new NaviBand(); band.Text = "NaviBand" + (naviBar1.Bands.Count + 1).ToString(); band.Name = "NaviBand" + (naviBar1.Bands.Count + 1).ToString(); band.LargeImageIndex = 2; band.SmallImageIndex = 2; naviBar1.Controls.Add(band); naviBar1.ResumeLayout(); naviBar1.PerformLayout(); }
/// <summary> /// Places the overflow buttons in the correct position /// </summary> private void LayoutOverflowButtons() { int compactFlow = (overflowCount * Bar.MinimizedButtonWidth) + 1; // This may seem odd but the buttons are positioned from the left to the right. // The first overflow button will appear as the first left button. if (Bar.ShowMoreOptionsButton) { compactFlow += optionButtonWidth; } for (int i = 0; i < overflowCount; i++) { ienum.MoveNext(); while (!ienum.Current.Visible) { ienum.MoveNext(); } NaviBand band = ienum.Current; if (band.Visible) { if (!Bar.Collapsed) { // TODO band.Button.Small = true; band.Button.Height = smallButtonRectangle.Height; band.Button.Width = Bar.MinimizedButtonWidth; if (Bar.RightToLeft == RightToLeft.Yes) { band.Button.Location = new Point(compactFlow - Bar.MinimizedButtonWidth, smallButtonRectangle.Top); } else { band.Button.Location = new Point(Bar.Width - compactFlow, smallButtonRectangle.Top); } compactFlow -= Bar.MinimizedButtonWidth; } else { // Collapsed, place buttons out of sight band.Button.Location = new Point(0, 0); band.Button.Size = new Size(0, 0); } } } }
private NaviBand addDetailControl(IUserDetailControl detailControl) { NaviBand band = new NaviBand(); band.Text = detailControl.Caption; band.Tag = detailControl; band.LargeImage = detailControl.SmallImage; band.SmallImage = detailControl.SmallImage; Control ctrl = (Control)detailControl; ctrl.Dock = DockStyle.Fill; band.ClientArea.Controls.Add(ctrl); naviBar1.Controls.Add(band); return(band); }
private void LayoutMenuItems() { for (int i = 0; i < menuCount; i++) { ienum.MoveNext(); while (!ienum.Current.Visible) { ienum.MoveNext(); } NaviBand band = (NaviBand)ienum.Current; // Collapsed, place buttons out of sight band.Button.Location = new Point(0, 0); band.Button.Size = new Size(0, 0); ToolStripMenuItem menuitem = new ToolStripMenuItem(); menuitem.Name = ""; menuitem.Size = new System.Drawing.Size(234, 22); menuitem.Text = band.Text; menuitem.Click += new EventHandler(menuitem_Click); if (band.SmallImage != null) { menuitem.Image = band.SmallImage; } else if ((band != null) && (band.SmallImageIndex >= 0) && (band.SmallImages != null) && (band.SmallImageIndex < band.SmallImages.Images.Count)) { menuitem.Image = band.SmallImages.Images[band.SmallImageIndex]; } menuitem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText; if (band == Bar.ActiveBand) { menuitem.Checked = true; menuitem.CheckState = System.Windows.Forms.CheckState.Checked; } else { menuitem.Checked = false; menuitem.CheckState = System.Windows.Forms.CheckState.Unchecked; } optionsMenu.Items.Add(menuitem); } }
private void InitTreeView(NaviBand band, IList <FunctionVo> functionlist) { TreeView treeView1 = new TreeView(); treeView1.Dock = System.Windows.Forms.DockStyle.Fill; treeView1.FullRowSelect = true; treeView1.Indent = 10; treeView1.ItemHeight = 50; treeView1.Location = new System.Drawing.Point(0, 0); treeView1.Name = band.Text; treeView1.ShowRootLines = false; treeView1.ShowLines = false; treeView1.Size = new System.Drawing.Size(196, 200); ImageList imagelist = new ImageList(); imagelist.ImageSize = new Size(48, 48); treeView1.ImageList = imagelist; treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); foreach (FunctionVo vo in functionlist) { TreeNode treeNode1 = new TreeNode(vo.Functionname); treeNode1.Tag = vo.Functionpath; treeNode1.Name = vo.Functionname; treeNode1.Text = vo.Functionname; Image icon = (Image)Properties.Resources.ResourceManager.GetObject(vo.Functionimage); if (icon == null) { icon = (Image)Properties.Resources.ResourceManager.GetObject("DefaultProgram"); } treeView1.ImageList.Images.Add(vo.Functionimage, icon); treeNode1.ImageKey = vo.Functionimage; treeNode1.SelectedImageKey = vo.Functionimage; treeView1.Nodes.Add(treeNode1); } band.ClientArea.Controls.Add(treeView1); }
public usrUserInformation() { InitializeComponent(); navUser = addDetailControl(new usrUserInfo()); navSizes = addDetailControl(new usrUserSizes()); InvitationListHost wpfHost = new InvitationListHost(); wpfHost.Child = new InvitationListControl(); wpfHost.Dock = DockStyle.Fill; navNewInvitations = addDetailControl(wpfHost); navMessages = addDetailControl(new usrMessagesBoard()); this.SuspendLayout(); foreach (var detailControl in PluginsManager.Instance.UserDetailControls) { addDetailControl(detailControl); } naviBar1.ActiveBand = navUser; updateButtons(false); this.ResumeLayout(); }
/// <summary> /// Infrastructure. Adds a band to the collection /// </summary> /// <param name="value">The band to add</param> internal void AddInternal(NaviBand value) { innerList.Add(value); }
/// <summary> /// Initializes a new instance of the NaviBandEventArgs class /// </summary> /// <param name="newActiveButton">The new active band</param> public NaviBandEventArgs(NaviBand newActiveBand) : base() { this.newActiveBand = newActiveBand; }
/// <summary> /// Determines whether the list contains a specific value /// </summary> /// <param name="band">The value</param> /// <returns>Returns true if the list contains the item; false otherwise</returns> public bool Contains(NaviBand value) { return(innerList.Contains(value)); }
/// <summary> /// Infrastructure. Removes a band from the collection /// </summary> /// <param name="value">The band to remove</param> internal void RemoveInternal(NaviBand value) { innerList.Remove(value); }