private void OnPanelLayout(object sender, LayoutEventArgs e) { NavigationPanePanel p = ((NavigationPanePanel)sender); if (p.Controls.Count == 1 && !(p.Controls[0] is PanelEx)) // No header, expand to full height { p.Controls[0].Height = p.Height; return; } if (p.Controls.Count < 2) //just a header { return; } //assume all headers are the same height int headerHeight = p.Controls[1].Height; //these are in reverse order so the last header is actually slot 1 rather than 0 foreach (Control control in p.Controls) { //assume that anything of this class is a header //(might be a bad assumption someday) if (!(control is PanelEx)) { control.Height = (p.Height - (headerHeight * (p.Controls.Count / 2))) / (p.Controls.Count / 2); } } }
private void AddOneControlToPanel(Control control, NavigationPanePanel navPane, int controlCount) { // As per LT-3392, this section has been commented out to remove the header // If we change our minds, just remove the comments and everything should work again //PanelEx header = new PanelEx(); //header.Text = ((ChoiceGroup)control.Tag).Label; //header.Dock = DockStyle.Top; //header.Location = new System.Drawing.Point(1, 1); //header.Name = "panelEx1"; //header.Size = new System.Drawing.Size(182, 20); //header.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; //header.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; //header.Style.BackgroundImagePosition = DevComponents.DotNetBar.eBackgroundImagePosition.Tile; //header.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; //header.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; //header.Style.GradientAngle = 90; //header.Style.MarginLeft = 4; control.Dock = DockStyle.Top; navPane.Controls.Add(control); //navPane.Controls.Add(header); }
//this did not work out well because this event, though it is a result of clicking and //area button, actually comes before the event that tells us the button was changed! //therefore, stuff that would set up the list dynamically depending on the area will get it wrong. //therefore, we stopped using this and moved to putting all of the handling into the //OnClick event for the Area button. private void OnPanelVisibleChanged(object sender, EventArgs e) { NavigationPanePanel panel = (NavigationPanePanel)sender; if (!panel.Visible) { return; } foreach (Control control in panel.Controls) { if (control.Tag == null) { continue; } ChoiceGroup group = (ChoiceGroup)control.Tag; group.OnDisplay(this, null); } }
private void AddControlsToPanel(ListPropertyChoice choice, NavigationPanePanel p) { ArrayList controls = AddSubControlsForButton(choice); p.Controls.Clear(); //DON"T DISPOSE! //ArrayList controls =((PanelMaker)maker).GetControlsFromChoice(choice); //we reversed these because we want to show them from top to bottom, //but the way controls work in forms, we have to actually add them in reverse order. if (controls != null) { controls.Reverse(); foreach (Control control in controls) { AddOneControlToPanel(control, p, controls.Count); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a SideBarTab /// </summary> /// <param name="owningAdapter"></param> /// <param name="mediator"></param> /// <param name="tabProps"></param> /// ------------------------------------------------------------------------------------ internal SideBarTab(SIBAdapter owningAdapter, Mediator mediator, SBTabProperties tabProps) : base(tabProps.Name, tabProps.Text) { m_owningAdapter = owningAdapter; m_mediator = mediator; m_message = tabProps.Message; m_tag = tabProps.Tag; m_infoBarButtonToolTipFormat = tabProps.InfoBarButtonToolTipFormat; ImageIndex = tabProps.ImageIndex; OptionGroup = "FwNavPanelTabs"; ButtonStyle = eButtonStyle.ImageAndText; ThemeAware = owningAdapter.m_dnbMngr.IsThemeActive; Enabled = tabProps.Enabled; owningAdapter.m_navPane.Items.Add(this); // This has to be done after being added to the pane's item collection. // Add the panel (above the tab) that goes with the tab. This is a control // above the stack of buttons. NavigationPanePanel panel = new NavigationPanePanel(); panel.Name = tabProps.Name; panel.ParentItem = this; panel.Dock = DockStyle.Fill; owningAdapter.m_navPane.Controls.Add(panel); // Add to the panel that holds the DNB toolbar that holds the tab items. m_itemPanel = new ItemPanel(Name, owningAdapter); m_itemPanel.ImageListSmall = m_smallImageList; m_itemPanel.ImageListLarge = m_largeImageList; m_itemPanel.SmallIconMode = tabProps.SmallIconMode; panel.Controls.Add(m_itemPanel); InitMenuAndInfoBarButton(tabProps); Tooltip = Text; }
/// <summary> /// do an update of the panels assigned to this button in order to, for /// example, show the tools that go with the currently selected area button. /// </summary> /// <param name="panel"></param> private void RefreshPanel(NavigationPanePanel panel) { // if (panel != null) // { // AddControlsToPanel((ListPropertyChoice)panel.ParentItem.Tag, panel); // //AddSubControlsForButton((ListPropertyChoice)panel.ParentItem.Tag); // panel.Refresh(); // // ((NavigationPane)(m_control)).RecalcLayout(); // // this.MyControl.Refresh(); // foreach(Control subcontrol in panel. Controls) // { // if (subcontrol. Tag == null) // continue; // ChoiceGroup group = (ChoiceGroup)subcontrol.Tag; // // //this will cause any listeners to be able to update the list, // //and then the list will turn around and request that we // //update the display of the list. // group.OnDisplay(this,null); // // } // } }
private TreeView GetPanelTreeView(NavigationPanePanel panel) { TreeView tree=treeBars; if(panel==navigationPanePanel2) tree=treeMenus; else if(panel==navigationPanePanel3) tree=treeCategories; return tree; }