/// <summary> /// Initializes a new instance of the CaptionGlyph class. /// </summary> /// <param name="behaviorService"></param> /// <param name="xpanderPanel"></param> public XPanderPanelCaptionGlyph(System.Windows.Forms.Design.Behavior.BehaviorService behaviorService, XPanderPanel xpanderPanel) : base(new XPanderPanelCaptionClickBehavior(xpanderPanel)) { m_behaviorService = behaviorService; m_xpanderPanel = xpanderPanel; }
private int GetTopPosition() { int iTopPosition = this.Padding.Top; int iNextTopPosition = 0; //The next top position is the highest top value + that controls height, with a //little vertical spacing thrown in for good measure IEnumerator enumerator = this.XPanderPanels.GetEnumerator(); while (enumerator.MoveNext()) { XPanderPanel xpanderPanel = (XPanderPanel)enumerator.Current; if (xpanderPanel.Visible == true) { if (iNextTopPosition == this.Padding.Top) { iTopPosition = this.Padding.Top; } else { iTopPosition = iNextTopPosition; } iNextTopPosition = iTopPosition + xpanderPanel.Height; } } return(iTopPosition); }
/// <summary> /// expands the specified panel /// </summary> /// <param name="panel">panel to expand</param> public void Expand(BasePanel panel) { if (panel == null) { throw new ArgumentNullException("panel", string.Format(System.Globalization.CultureInfo.InvariantCulture, BSE.Windows.Forms.Properties.Resources.IDS_ArgumentException, "panel")); } XPanderPanel xpanderPanel = panel as XPanderPanel; if (xpanderPanel != null) { foreach (XPanderPanel tmpXPanderPanel in this.m_xpanderPanels) { if (tmpXPanderPanel.Equals(xpanderPanel) == false) { tmpXPanderPanel.Expand = false; } } PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(xpanderPanel)["Expand"]; if (propertyDescriptor != null) { propertyDescriptor.SetValue(xpanderPanel, true); } } }
/// <summary> /// Adds an item to the IList. /// </summary> /// <param name="value">The Object to add to the IList.</param> /// <returns>The position into which the new element was inserted.</returns> int IList.Add(object value) { XPanderPanel xpanderPanel = value as XPanderPanel; if(xpanderPanel == null) { throw new ArgumentException(string.Format(System.Globalization.CultureInfo.CurrentUICulture, Resources.IDS_ArgumentException, typeof(XPanderPanel).Name)); } this.Add(xpanderPanel); return this.IndexOf(xpanderPanel); }
/// <summary> /// Initializes the designer with the specified component. /// </summary> /// <param name="component">The IComponent to associate with the designer.</param> public override void Initialize(IComponent component) { base.Initialize(component); XPanderPanel xpanderPanel = Control as XPanderPanel; if (xpanderPanel != null) { this.m_adorner = new System.Windows.Forms.Design.Behavior.Adorner(); BehaviorService.Adorners.Add(this.m_adorner); this.m_adorner.Glyphs.Add(new XPanderPanelCaptionGlyph(BehaviorService, xpanderPanel)); } }
private static void DrawInnerBorders(Graphics graphics, XPanderPanel xpanderPanel) { if (xpanderPanel.ShowBorder) { using (var graphicsPath = new GraphicsPath()) { var captionRectangle = xpanderPanel.CaptionRectangle; var xpanderPanelList = xpanderPanel.Parent as XPanderPanelList; if ((xpanderPanelList != null) && (xpanderPanelList.Dock == DockStyle.Fill)) { var panel = xpanderPanelList.Parent as Panel; var parentXPanderPanel = xpanderPanelList.Parent as XPanderPanel; if (((panel != null) && (panel.Padding == new Padding(0))) || ((parentXPanderPanel != null) && (parentXPanderPanel.Padding == new Padding(0)))) { //Left vertical borderline graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + captionRectangle.Height, captionRectangle.X, captionRectangle.Y + Constants.BorderThickness); if (xpanderPanel.Top == 0) { //Upper horizontal borderline graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y, captionRectangle.X + captionRectangle.Width, captionRectangle.Y); } else { //Upper horizontal borderline graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + Constants.BorderThickness, captionRectangle.X + captionRectangle.Width, captionRectangle.Y + Constants.BorderThickness); } } } else { //Left vertical borderline graphicsPath.AddLine(captionRectangle.X + Constants.BorderThickness, captionRectangle.Y + captionRectangle.Height, captionRectangle.X + Constants.BorderThickness, captionRectangle.Y); if (xpanderPanel.Top == 0) { //Upper horizontal borderline graphicsPath.AddLine(captionRectangle.X + Constants.BorderThickness, captionRectangle.Y + Constants.BorderThickness, captionRectangle.X + captionRectangle.Width - Constants.BorderThickness, captionRectangle.Y + Constants.BorderThickness); } else { //Upper horizontal borderline graphicsPath.AddLine(captionRectangle.X + Constants.BorderThickness, captionRectangle.Y, captionRectangle.X + captionRectangle.Width - Constants.BorderThickness, captionRectangle.Y); } } using (var borderPen = new Pen(xpanderPanel.PanelColors.InnerBorderColor)) { graphics.DrawPath(borderPen, graphicsPath); } } } }
private void InitCustomColors(Dictionary <KnownColors, Color> rgbTable) { Panel panel = this.m_basePanel as Panel; if (panel != null) { rgbTable[KnownColors.BorderColor] = panel.CustomColors.BorderColor; rgbTable[KnownColors.InnerBorderColor] = panel.CustomColors.InnerBorderColor; rgbTable[KnownColors.PanelCaptionCloseIcon] = panel.CustomColors.CaptionCloseIcon; rgbTable[KnownColors.PanelCaptionExpandIcon] = panel.CustomColors.CaptionExpandIcon; rgbTable[KnownColors.PanelCaptionGradientBegin] = panel.CustomColors.CaptionGradientBegin; rgbTable[KnownColors.PanelCaptionGradientEnd] = panel.CustomColors.CaptionGradientEnd; rgbTable[KnownColors.PanelCaptionGradientMiddle] = panel.CustomColors.CaptionGradientMiddle; rgbTable[KnownColors.PanelCaptionSelectedGradientBegin] = panel.CustomColors.CaptionSelectedGradientBegin; rgbTable[KnownColors.PanelCaptionSelectedGradientEnd] = panel.CustomColors.CaptionSelectedGradientEnd; rgbTable[KnownColors.PanelContentGradientBegin] = panel.CustomColors.ContentGradientBegin; rgbTable[KnownColors.PanelContentGradientEnd] = panel.CustomColors.ContentGradientEnd; rgbTable[KnownColors.PanelCaptionText] = panel.CustomColors.CaptionText; rgbTable[KnownColors.PanelCollapsedCaptionText] = panel.CustomColors.CollapsedCaptionText; } XPanderPanel xpanderPanel = this.m_basePanel as XPanderPanel; if (xpanderPanel != null) { rgbTable[KnownColors.BorderColor] = xpanderPanel.CustomColors.BorderColor; rgbTable[KnownColors.InnerBorderColor] = xpanderPanel.CustomColors.InnerBorderColor; rgbTable[KnownColors.XPanderPanelBackColor] = xpanderPanel.CustomColors.BackColor; rgbTable[KnownColors.XPanderPanelCaptionCloseIcon] = xpanderPanel.CustomColors.CaptionCloseIcon; rgbTable[KnownColors.XPanderPanelCaptionExpandIcon] = xpanderPanel.CustomColors.CaptionExpandIcon; rgbTable[KnownColors.XPanderPanelCaptionText] = xpanderPanel.CustomColors.CaptionText; rgbTable[KnownColors.XPanderPanelCaptionGradientBegin] = xpanderPanel.CustomColors.CaptionGradientBegin; rgbTable[KnownColors.XPanderPanelCaptionGradientEnd] = xpanderPanel.CustomColors.CaptionGradientEnd; rgbTable[KnownColors.XPanderPanelCaptionGradientMiddle] = xpanderPanel.CustomColors.CaptionGradientMiddle; rgbTable[KnownColors.XPanderPanelFlatCaptionGradientBegin] = xpanderPanel.CustomColors.FlatCaptionGradientBegin; rgbTable[KnownColors.XPanderPanelFlatCaptionGradientEnd] = xpanderPanel.CustomColors.FlatCaptionGradientEnd; rgbTable[KnownColors.XPanderPanelPressedCaptionBegin] = xpanderPanel.CustomColors.CaptionPressedGradientBegin; rgbTable[KnownColors.XPanderPanelPressedCaptionEnd] = xpanderPanel.CustomColors.CaptionPressedGradientEnd; rgbTable[KnownColors.XPanderPanelPressedCaptionMiddle] = xpanderPanel.CustomColors.CaptionPressedGradientMiddle; rgbTable[KnownColors.XPanderPanelCheckedCaptionBegin] = xpanderPanel.CustomColors.CaptionCheckedGradientBegin; rgbTable[KnownColors.XPanderPanelCheckedCaptionEnd] = xpanderPanel.CustomColors.CaptionCheckedGradientEnd; rgbTable[KnownColors.XPanderPanelCheckedCaptionMiddle] = xpanderPanel.CustomColors.CaptionCheckedGradientMiddle; rgbTable[KnownColors.XPanderPanelSelectedCaptionBegin] = xpanderPanel.CustomColors.CaptionSelectedGradientBegin; rgbTable[KnownColors.XPanderPanelSelectedCaptionEnd] = xpanderPanel.CustomColors.CaptionSelectedGradientEnd; rgbTable[KnownColors.XPanderPanelSelectedCaptionMiddle] = xpanderPanel.CustomColors.CaptionSelectedGradientMiddle; rgbTable[KnownColors.XPanderPanelSelectedCaptionText] = xpanderPanel.CustomColors.CaptionSelectedText; } }
private void InitCustomColors(ref Dictionary <KnownColors, Color> rgbTable) { rgbTable[KnownColors.BorderColor] = this.m_basePanel.BorderColor; rgbTable[KnownColors.InnerBorderColor] = this.m_basePanel.InnerBorderColor; Panel panel = this.m_basePanel as Panel; if (panel != null) { rgbTable[KnownColors.PanelCaptionCloseIcon] = this.m_basePanel.CloseIconForeColor; rgbTable[KnownColors.PanelCaptionExpandIcon] = this.m_basePanel.CaptionForeColor; rgbTable[KnownColors.PanelCaptionGradientBegin] = this.m_basePanel.ColorCaptionGradientBegin; rgbTable[KnownColors.PanelCaptionGradientEnd] = this.m_basePanel.ColorCaptionGradientEnd; rgbTable[KnownColors.PanelCaptionGradientMiddle] = this.m_basePanel.ColorCaptionGradientMiddle; rgbTable[KnownColors.PanelContentGradientBegin] = panel.ColorContentPanelGradientBegin; rgbTable[KnownColors.PanelContentGradientEnd] = panel.ColorContentPanelGradientEnd; rgbTable[KnownColors.PanelCaptionText] = panel.CaptionForeColor; rgbTable[KnownColors.PanelCollapsedCaptionText] = panel.CollapsedCaptionForeColor; } XPanderPanel xpanderPanel = this.m_basePanel as XPanderPanel; if (xpanderPanel != null) { rgbTable[KnownColors.XPanderPanelBackColor] = xpanderPanel.BackColor; rgbTable[KnownColors.XPanderPanelCaptionCloseIcon] = this.m_basePanel.CloseIconForeColor; rgbTable[KnownColors.XPanderPanelCaptionExpandIcon] = this.m_basePanel.CaptionForeColor; rgbTable[KnownColors.XPanderPanelCaptionText] = xpanderPanel.CaptionForeColor; rgbTable[KnownColors.XPanderPanelCaptionGradientBegin] = xpanderPanel.ColorCaptionGradientBegin; rgbTable[KnownColors.XPanderPanelCaptionGradientEnd] = xpanderPanel.ColorCaptionGradientEnd; rgbTable[KnownColors.XPanderPanelCaptionGradientMiddle] = xpanderPanel.ColorCaptionGradientMiddle; rgbTable[KnownColors.XPanderPanelFlatCaptionGradientBegin] = xpanderPanel.ColorFlatCaptionGradientBegin; rgbTable[KnownColors.XPanderPanelFlatCaptionGradientEnd] = xpanderPanel.ColorFlatCaptionGradientEnd; rgbTable[KnownColors.XPanderPanelPressedCaptionBegin] = this.m_professionalColorTable.ButtonPressedGradientBegin; rgbTable[KnownColors.XPanderPanelPressedCaptionEnd] = this.m_professionalColorTable.ButtonPressedGradientEnd; rgbTable[KnownColors.XPanderPanelPressedCaptionMiddle] = this.m_professionalColorTable.ButtonPressedGradientMiddle; rgbTable[KnownColors.XPanderPanelSelectedCaptionBegin] = this.m_professionalColorTable.ButtonCheckedGradientBegin; rgbTable[KnownColors.XPanderPanelSelectedCaptionEnd] = this.m_professionalColorTable.ButtonCheckedGradientEnd; rgbTable[KnownColors.XPanderPanelSelectedCaptionMiddle] = this.m_professionalColorTable.ButtonCheckedGradientMiddle; rgbTable[KnownColors.XPanderPanelSelectedCaptionText] = SystemColors.ControlText; } }
/// <summary> /// expands the specified xpanderpanel /// </summary> /// <param name="xpanderPanel">xpanderpanel for expand</param> public void Expand(XPanderPanel xpanderPanel) { if (xpanderPanel == null) { throw new ArgumentException( string.Format(System.Globalization.CultureInfo.CurrentUICulture, Resources.IDS_ArgumentException, typeof(XPanderPanel).Name)); } else { foreach (XPanderPanel tmpXPanderPanel in this.m_xpanderPanels) { if (tmpXPanderPanel.Equals(xpanderPanel) == false) { tmpXPanderPanel.Expand = false; } } xpanderPanel.Expand = true; } }
//stone: 2019-10-29 private XPanderPanel addPanderPanel(bool expand, string text, string name) { XPanderPanel xPanderPanel = new BSE.Windows.Forms.XPanderPanel(); xPanderPanel.BackColor = System.Drawing.SystemColors.Window; xPanderPanel.CaptionFont = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold); xPanderPanel.CaptionForeColor = System.Drawing.SystemColors.ControlText; xPanderPanel.ColorCaptionGradientBegin = System.Drawing.Color.FromArgb(((int)(((byte)(216)))), ((int)(((byte)(232)))), ((int)(((byte)(252))))); xPanderPanel.ColorCaptionGradientEnd = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(177)))), ((int)(((byte)(230))))); xPanderPanel.ColorCaptionGradientMiddle = System.Drawing.Color.FromArgb(((int)(((byte)(186)))), ((int)(((byte)(210)))), ((int)(((byte)(243))))); xPanderPanel.ColorScheme = BSE.Windows.Forms.ColorScheme.Custom; xPanderPanel.Expand = expand; xPanderPanel.ForeColor = System.Drawing.SystemColors.ControlText; xPanderPanel.Image = global::LocalERP.Properties.Resources.apply16; xPanderPanel.Name = "xPanderPanel_" + name; xPanderPanel.Padding = new System.Windows.Forms.Padding(12, 33, 12, 11); xPanderPanel.TabIndex = 5; xPanderPanel.Text = text; this.xPanderPanelList1.Controls.Add(xPanderPanel); return(xPanderPanel); }
private static void DrawInnerBorders(Graphics graphics, XPanderPanel xpanderPanel) { if(xpanderPanel.ShowBorder == true) { using(GraphicsPath graphicsPath = new GraphicsPath()) { Rectangle captionRectangle = xpanderPanel.CaptionRectangle; XPanderPanelList xpanderPanelList = xpanderPanel.Parent as XPanderPanelList; if((xpanderPanelList != null) && (xpanderPanelList.Dock == DockStyle.Fill)) { BSE.Windows.Forms.Panel panel = xpanderPanelList.Parent as BSE.Windows.Forms.Panel; XPanderPanel parentXPanderPanel = xpanderPanelList.Parent as XPanderPanel; if(((panel != null) && (panel.Padding == new Padding(0))) || ((parentXPanderPanel != null) && (parentXPanderPanel.Padding == new Padding(0)))) { //Left vertical borderline graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + captionRectangle.Height, captionRectangle.X, captionRectangle.Y + Constants.BorderThickness); if(xpanderPanel.Top == 0) { //Upper horizontal borderline graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y, captionRectangle.X + captionRectangle.Width, captionRectangle.Y); } else { //Upper horizontal borderline graphicsPath.AddLine(captionRectangle.X, captionRectangle.Y + Constants.BorderThickness, captionRectangle.X + captionRectangle.Width, captionRectangle.Y + Constants.BorderThickness); } } } else { //Left vertical borderline graphicsPath.AddLine(captionRectangle.X + Constants.BorderThickness, captionRectangle.Y + captionRectangle.Height, captionRectangle.X + Constants.BorderThickness, captionRectangle.Y); if(xpanderPanel.Top == 0) { //Upper horizontal borderline graphicsPath.AddLine(captionRectangle.X + Constants.BorderThickness, captionRectangle.Y + Constants.BorderThickness, captionRectangle.X + captionRectangle.Width - Constants.BorderThickness, captionRectangle.Y + Constants.BorderThickness); } else { //Upper horizontal borderline graphicsPath.AddLine(captionRectangle.X + Constants.BorderThickness, captionRectangle.Y, captionRectangle.X + captionRectangle.Width - Constants.BorderThickness, captionRectangle.Y); } } using(Pen borderPen = new Pen(xpanderPanel.PanelColors.InnerBorderColor)) { graphics.DrawPath(borderPen, graphicsPath); } } } }
/// <summary> /// Initializes a new instance of the Behavior class. /// </summary> /// <param name="xpanderPanel">XPanderPanel for this behaviour</param> public XPanderPanelCaptionClickBehavior(XPanderPanel xpanderPanel) { m_xpanderPanel = xpanderPanel; }
private static void DrawBorders(Graphics graphics, XPanderPanel xpanderPanel) { if(xpanderPanel.ShowBorder == true) { using(GraphicsPath graphicsPath = new GraphicsPath()) { using(Pen borderPen = new Pen(xpanderPanel.PanelColors.BorderColor, Constants.BorderThickness)) { Rectangle captionRectangle = xpanderPanel.CaptionRectangle; Rectangle borderRectangle = captionRectangle; if(xpanderPanel.Expand == true) { borderRectangle = xpanderPanel.ClientRectangle; graphics.DrawLine( borderPen, captionRectangle.Left, captionRectangle.Top + captionRectangle.Height - Constants.BorderThickness, captionRectangle.Left + captionRectangle.Width, captionRectangle.Top + captionRectangle.Height - Constants.BorderThickness); } XPanderPanelList xpanderPanelList = xpanderPanel.Parent as XPanderPanelList; if((xpanderPanelList != null) && (xpanderPanelList.Dock == DockStyle.Fill)) { BSE.Windows.Forms.Panel panel = xpanderPanelList.Parent as BSE.Windows.Forms.Panel; XPanderPanel parentXPanderPanel = xpanderPanelList.Parent as XPanderPanel; if(((panel != null) && (panel.Padding == new Padding(0))) || ((parentXPanderPanel != null) && (parentXPanderPanel.Padding == new Padding(0)))) { if(xpanderPanel.Top != 0) { graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left + captionRectangle.Width, borderRectangle.Top); } // Left vertical borderline graphics.DrawLine(borderPen, borderRectangle.Left, borderRectangle.Top, borderRectangle.Left, borderRectangle.Top + borderRectangle.Height); // Right vertical borderline graphics.DrawLine(borderPen, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height); } else { // Upper horizontal borderline only at the top xpanderPanel if(xpanderPanel.Top == 0) { graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width, borderRectangle.Top); } // Left vertical borderline graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left, borderRectangle.Top + borderRectangle.Height); //Lower horizontal borderline graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness); // Right vertical borderline graphicsPath.AddLine( borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height); } } else { // Upper horizontal borderline only at the top xpanderPanel if(xpanderPanel.Top == 0) { graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width, borderRectangle.Top); } // Left vertical borderline graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left, borderRectangle.Top + borderRectangle.Height); //Lower horizontal borderline graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness); // Right vertical borderline graphicsPath.AddLine( borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height); } } using(Pen borderPen = new Pen(xpanderPanel.PanelColors.BorderColor, Constants.BorderThickness)) { graphics.DrawPath(borderPen, graphicsPath); } } } }
/// <summary> /// Determines whether the XPanderPanelCollection contains a specific XPanderPanel /// </summary> /// <param name="xpanderPanel">The XPanderPanel to locate in the XPanderPanelCollection</param> /// <returns>true if the XPanderPanelCollection contains the specified value; otherwise, false.</returns> public bool Contains(XPanderPanel xpanderPanel) { return(this.m_controlCollection.Contains(xpanderPanel)); }
/// <summary> /// 递归创建MenuStrip菜单(模块列表) /// </summary> /// <param name="MenuDT">菜单数据</param> private void LoadToolbarItem(DataTable MenuDT) { DataView dvList = new DataView(MenuDT); dvList.RowFilter = "FATHER_ID='" + "0" + "'"; foreach (DataRowView dv in dvList) { if (dv["MENU_NAME"].ToString().Equals("Exit")) { continue; } XPanderPanel xPanderPanel = new XPanderPanel(); xPanderPanel.Dock = DockStyle.Fill; ToolStrip toolStrip = new ToolStrip(); toolStrip.Dock = DockStyle.Fill; toolStrip.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; toolStrip.ImageList = this.imageList1; toolStrip.ImageScalingSize = new System.Drawing.Size(48, 48); xPanderPanel.Tag = dv["MENU_NAME"].ToString(); xPanderPanel.Text = dv["MENU_TEXT"].ToString(); xPanderPanel.CaptionHeight = 30; xPanderPanel.CaptionFont = new System.Drawing.Font("SimSun", 12f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); ToolBarPannelList.XPanderPanels.Add(xPanderPanel); xPanderPanel.Controls.Add(toolStrip); xPanderPanel.BackgroundImage = Properties.Resources.Desktop; xPanderPanel.BackgroundImageLayout = ImageLayout.Stretch; toolStrip.BackgroundImage = Properties.Resources.Desktop; toolStrip.BackgroundImageLayout = ImageLayout.Stretch; DataView dvSubList = new DataView(MenuDT); dvSubList.RowFilter = "FATHER_ID='" + dv["ID"].ToString() + "'"; foreach (DataRowView subDv in dvSubList) { ToolStripButton toolStripButton = new System.Windows.Forms.ToolStripButton(); toolStripButton.Tag = subDv["MENU_NAME"].ToString(); toolStripButton.Text = subDv["MENU_TEXT"].ToString(); // toolStripButton.Size = new System.Drawing.Size(138, 64); // toolStripButton.ImageIndex = i; toolStripButton.ImageKey = subDv["IMAGE_KEY"].ToString(); toolStripButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; toolStripButton.TextImageRelation = TextImageRelation.ImageAboveText; toolStripButton.Click += new EventHandler(subItem_Click); toolStrip.Items.Add(toolStripButton); ToolStripSeparator toolStripSeparator = new ToolStripSeparator(); toolStrip.Items.Add(toolStripSeparator); } } }
/// <summary> /// Copies the elements of the collection to an Array, starting at a particular Array index. /// </summary> /// <param name="xpanderPanels">The one-dimensional Array that is the destination of the elements copied from ICollection. /// The Array must have zero-based indexing. ///</param> /// <param name="index">The zero-based index in array at which copying begins.</param> public void CopyTo(XPanderPanel[] xpanderPanels, int index) { this.m_controlCollection.CopyTo(xpanderPanels, index); }
private static void DrawBorders(Graphics graphics, XPanderPanel xpanderPanel) { if (xpanderPanel.ShowBorder) { using (var graphicsPath = new GraphicsPath()) { using (var borderPen = new Pen(xpanderPanel.PanelColors.BorderColor, Constants.BorderThickness)) { var captionRectangle = xpanderPanel.CaptionRectangle; var borderRectangle = captionRectangle; if (xpanderPanel.Expand) { borderRectangle = xpanderPanel.ClientRectangle; graphics.DrawLine( borderPen, captionRectangle.Left, captionRectangle.Top + captionRectangle.Height - Constants.BorderThickness, captionRectangle.Left + captionRectangle.Width, captionRectangle.Top + captionRectangle.Height - Constants.BorderThickness); } var xpanderPanelList = xpanderPanel.Parent as XPanderPanelList; if ((xpanderPanelList != null) && (xpanderPanelList.Dock == DockStyle.Fill)) { var panel = xpanderPanelList.Parent as Panel; var parentXPanderPanel = xpanderPanelList.Parent as XPanderPanel; if (((panel != null) && (panel.Padding == new Padding(0))) || ((parentXPanderPanel != null) && (parentXPanderPanel.Padding == new Padding(0)))) { if (xpanderPanel.Top != 0) { graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left + captionRectangle.Width, borderRectangle.Top); } // Left vertical borderline graphics.DrawLine(borderPen, borderRectangle.Left, borderRectangle.Top, borderRectangle.Left, borderRectangle.Top + borderRectangle.Height); // Right vertical borderline graphics.DrawLine(borderPen, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height); } else { // Upper horizontal borderline only at the top xpanderPanel if (xpanderPanel.Top == 0) { graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width, borderRectangle.Top); } // Left vertical borderline graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left, borderRectangle.Top + borderRectangle.Height); //Lower horizontal borderline graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness); // Right vertical borderline graphicsPath.AddLine( borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height); } } else { // Upper horizontal borderline only at the top xpanderPanel if (xpanderPanel.Top == 0) { graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width, borderRectangle.Top); } // Left vertical borderline graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top, borderRectangle.Left, borderRectangle.Top + borderRectangle.Height); //Lower horizontal borderline graphicsPath.AddLine( borderRectangle.Left, borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height - Constants.BorderThickness); // Right vertical borderline graphicsPath.AddLine( borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top, borderRectangle.Left + borderRectangle.Width - Constants.BorderThickness, borderRectangle.Top + borderRectangle.Height); } } using (var borderPen = new Pen(xpanderPanel.PanelColors.BorderColor, Constants.BorderThickness)) { graphics.DrawPath(borderPen, graphicsPath); } } } }
/// <summary> /// Returns the index of the specified XPanderPanel in the collection. /// </summary> /// <param name="xpanderPanel">The xpanderPanel to find the index of.</param> /// <returns>The index of the xpanderPanel, or -1 if the xpanderPanel is not in the <see ref="ControlCollection">ControlCollection</see> instance.</returns> public int IndexOf(XPanderPanel xpanderPanel) { return this.m_controlCollection.IndexOf(xpanderPanel); }
/// <summary> /// Inserts an XPanderPanel to the collection at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted. </param> /// <param name="xpanderPanel">The XPanderPanel to insert into the Collection.</param> public void Insert(int index, XPanderPanel xpanderPanel) { ((IList) this).Insert(index, (object) xpanderPanel); }
/// <summary> /// Adds a XPanderPanel to the collection. /// </summary> /// <param name="xpanderPanel">The XPanderPanel to add.</param> public void Add(XPanderPanel xpanderPanel) { this.m_controlCollection.Add(xpanderPanel); this.m_xpanderPanelList.Invalidate(); }
/// <summary> /// Removes the first occurrence of a specific XPanderPanel from the XPanderPanelCollection /// </summary> /// <param name="xpanderPanel">The XPanderPanel to remove from the XPanderPanelCollection</param> public void Remove(XPanderPanel xpanderPanel) { this.m_controlCollection.Remove(xpanderPanel); }
/// <summary> /// Initializes a new instance of the Behavior class. /// </summary> /// <param name="xpanderPanel">XPanderPanel for this behaviour</param> public XPanderPanelCaptionClickBehavior(XPanderPanel xpanderPanel) { this.m_xpanderPanel = xpanderPanel; }
/// <summary> /// Returns the index of the specified XPanderPanel in the collection. /// </summary> /// <param name="xpanderPanel">The xpanderPanel to find the index of.</param> /// <returns>The index of the xpanderPanel, or -1 if the xpanderPanel is not in the <see ref="ControlCollection">ControlCollection</see> instance.</returns> public int IndexOf(XPanderPanel xpanderPanel) { return(this.m_controlCollection.IndexOf(xpanderPanel)); }
/// <summary> /// Inserts an XPanderPanel to the collection at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted. </param> /// <param name="xpanderPanel">The XPanderPanel to insert into the Collection.</param> public void Insert(int index, XPanderPanel xpanderPanel) { ((IList)this).Insert(index, (object)xpanderPanel); }
/// <summary> /// Initializes a new instance of the CaptionGlyph class. /// </summary> /// <param name="behaviorService"></param> /// <param name="xpanderPanel"></param> public XPanderPanelCaptionGlyph(System.Windows.Forms.Design.Behavior.BehaviorService behaviorService, XPanderPanel xpanderPanel) : base(new XPanderPanelCaptionClickBehavior(xpanderPanel)) { this.m_behaviorService = behaviorService; this.m_xpanderPanel = xpanderPanel; }
/// <summary> /// Determines whether the XPanderPanelCollection contains a specific XPanderPanel /// </summary> /// <param name="xpanderPanel">The XPanderPanel to locate in the XPanderPanelCollection</param> /// <returns>true if the XPanderPanelCollection contains the specified value; otherwise, false.</returns> public bool Contains(XPanderPanel xpanderPanel) { return this.m_controlCollection.Contains(xpanderPanel); }