Introduction
The XPander library offers the option to store many user controls in one single document formula. They are optionally visible or non-visible, expanded or collapsed. The controls provide optically the Microsoft Outlook 2007 style with black, silver and blue color schemes. They also provide other styles. The included ToolStripRenderers offer some other opportunities. All the controls support visual designer, smart tag and RightToLeft features. It contains the following components.
BSE.Windows.Forms.Panel
The panel is a control that contains other controls. You can use a panel to group collections of controls such as the XPanderPanelList control. On top of the panel, there is the captionbar. This captionbar may contain an image and text. According to its dockstyle and properties, the panel is collapsible and/or closable.


BSE.Windows.Forms.XPanderPanelList
The XPanderPanelList contains XPanderPanels, which are represented by XPanderPanel objects that you can add through the XPanderPanels property. The order of XPanderPanel objects reflects the order in which the xpanderpanels appear in the XPanderPanelList control.
BSE.Windows.Forms.XPanderPanel
XPanderPanel controls represent the expandable and collapsible panels in XPanderPanelList. The XpanderPanel is a control that contains other controls. You can use an XPanderPanel to group collections of controls such as the XPanderPanelList. The order of xpanderpanels in the XPanderPanelList.XPanderPanels collection reflects the order of xpanderpanels controls. To change the order of tabs in the control, you must change their positions in the collection by removing them and inserting them at new indexes. You can change the xpanderpanel's appearance. For example, to make it appear flat, set the CaptionStyle property to CaptionStyle.Flat.
On top of the XPanderPanel, there is the captionbar. This captionbar may contain an image and text. According to its properties, the panel can be closed.
BSE.Windows.Forms.Splitter
This represents a splitter control that enables the user to resize docked controls. As different from the System.Windows.Forms.Splitter, the splitter supports a transparent background color.
A splitter can be attached to a panel. If the visibility of the panel changes, the visibility of the splitter changes too.
All the panelcolors and properties are customizable and changeable with the visual designer.


If you want to expand a XPanderPanel in the Visual Designer, please click the captionbar.
When the RightToLeft property value is set to RightToLeft.Yes, the horizontal alignment of the control's elements are reversed.
Using the Code
Right click on the toolbox and choose add/remove items..., there you browse for the BSE.Windows.Forms.dll and press OK. All the controls will be added in the ToolBox under "My User Controls". Set BSE.Windows.Test as StartUp Project.
Using the RightToLeft Feature in the Test Sample
Open the Program.cs file in the BSE.Windows.Test project and remove the following comments:
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
Select the ar-EG culture name for the Arabic (Egypt) culture:
Class Diagrams
XPanderPanelList
Panel and XPanderPanel
Code Examples
Using the ToolstripProfessionalRenderer and the PanelsettingsManager at runtime:
public class Form2 : Form
{
private BSE.Windows.Forms.Panel panel1;
public Form2()
{
this.panel1 = new BSE.Windows.Forms.Panel();
this.panel1.Text = "panel1";
this.panel1.ShowTransparentBackground = false;
this.panel1.Dock = DockStyle.Fill;
this.Controls.Add(this.panel1);
ToolStripProfessionalRenderer renderer =
new BSE.Windows.Forms.Office2007Renderer();
ToolStripManager.Renderer = renderer;
BSE.Windows.Forms.ProfessionalColorTable colorTable =
renderer.ColorTable as BSE.Windows.Forms.ProfessionalColorTable;
if (colorTable != null)
{
BSE.Windows.Forms.PanelColors panelColorTable =
colorTable.PanelColorTable;
if (panelColorTable != null)
{
BSE.Windows.Forms.PanelSettingsManager.
SetPanelProperties(this.Controls, panelColorTable);
}
}
}
}
Adaption of the Panel Colors
Create a colortable that derives from BSE.Windows.Forms.PanelColors and overwrite the protected method InitColors:
public class YourPanelColors : PanelColorsOffice
{
protected override void InitColors(Dictionary<panelcolors.knowncolors>, rgbTable)
{
base.InitColors(rgbTable);
rgbTable[KnownColors.BorderColor] = Color.FromArgb(101, 147, 207);
rgbTable[KnownColors.InnerBorderColor] = Color.White;
rgbTable[KnownColors.PanelCaptionCloseIcon] = Color.Black;
rgbTable[KnownColors.PanelCaptionExpandIcon] = Color.FromArgb(21, 66, 139);
rgbTable[KnownColors.PanelCaptionGradientBegin] =
Color.FromArgb(227, 239, 255);
rgbTable[KnownColors.PanelCaptionGradientEnd] =
Color.FromArgb(173, 209, 255);
rgbTable[KnownColors.PanelCaptionGradientMiddle] =
Color.FromArgb(199, 224, 255);
rgbTable[KnownColors.PanelContentGradientBegin] =
Color.FromArgb(227, 239, 255);
rgbTable[KnownColors.PanelContentGradientEnd] =
Color.FromArgb(227, 239, 255);
rgbTable[KnownColors.PanelCaptionText] = Color.FromArgb(22, 65, 139);
rgbTable[KnownColors.PanelCollapsedCaptionText] =
Color.FromArgb(21, 66, 139);
rgbTable[KnownColors.XPanderPanelBackColor] = Color.Transparent;
rgbTable[KnownColors.XPanderPanelCaptionCloseIcon] = Color.Black;
rgbTable[KnownColors.XPanderPanelCaptionExpandIcon] =
Color.FromArgb(21, 66, 139);
rgbTable[KnownColors.XPanderPanelCaptionText] = Color.FromArgb(21, 66, 139);
rgbTable[KnownColors.XPanderPanelCaptionGradientBegin] =
Color.FromArgb(227, 239, 255);
rgbTable[KnownColors.XPanderPanelCaptionGradientEnd] =
Color.FromArgb(199, 224, 255);
rgbTable[KnownColors.XPanderPanelCaptionGradientMiddle] =
Color.FromArgb(173, 209, 255);
rgbTable[KnownColors.XPanderPanelFlatCaptionGradientBegin] =
Color.FromArgb(214, 232, 255);
rgbTable[KnownColors.XPanderPanelFlatCaptionGradientEnd] =
Color.FromArgb(253, 253, 254);
}
} </panelcolors.knowncolors>
Or you may set the ColorScheme property to ColorScheme.Custom and fill the CustomColors properties with your colors.
Credits
- Thanks to Phil. Wright for his Office 2007
ToolStrip Renderer. That gave me an insight into toolstrip rendering.
- Thanks to Bernhard Jenny for many tips.
| You must Sign In to use this message board. |
|
|
 |
|
 |
put a System.Windows.Forms.TabControl with X page in panel. then move mouse over the page title. it will flickering.
I will appreciate any help on this.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi
I am hosting a TableLayoutPanel inside the two BSE.Windows.Forms.Panel Panels (not xPanel) docked top and bottom of mainform but when Panels are resized, there is heavy flickering of the table. The table contains about 10 rows. It is simple test application without any other controls.
I will appreciate any help on this.
Regards AKDM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi
change the OnPaintBackground method in the panel class to
protected override void OnPaintBackground(PaintEventArgs pevent) { if (this.ShowTransparentBackground == true) { base.OnPaintBackground(pevent); this.BackColor = Color.Transparent; } else { Rectangle rectangleBounds = this.ClientRectangle; if (this.m_bShowCaptionbar == true) { this.BackColor = Color.Transparent; rectangleBounds = new Rectangle( this.ClientRectangle.Left, this.ClientRectangle.Top + this.CaptionHeight, this.ClientRectangle.Width, this.ClientRectangle.Height - this.CaptionHeight); } RenderBackgroundGradient( pevent.Graphics, rectangleBounds, this.PanelColors.PanelContentGradientBegin, this.PanelColors.PanelContentGradientEnd, this.LinearGradientMode); } }
Then it should work
Regards Uwe
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi, I'd like implement panel collapsing when click on it (if it is expanded). This is my attempt:
private void xPanderPanel2_ExpandClick(object sender, EventArgs e) { if (xPanderPanel2.Expand == true & xPanderPanel1.Expand==false) { xPanderPanel2.Expand = false;
xPanderPanel1.Expand = true; } } ...not working.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, there is an example for this in the demo form1.
private void btnExpandXPander_Click(object sender, EventArgs e) { if (xPanderPanel10 != null) { BSE.Windows.Forms.XPanderPanelList panelList = xPanderPanel10.Parent as BSE.Windows.Forms.XPanderPanelList; if (panelList != null) { panelList.Expand(xPanderPanel10); } } }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
It's a wonderful control. However, I am having hard time changing the panel color using Office2007BlueColorTable. Using the combox box under panel6 in test harness does not affect the color. I have tried following snippet in my sample app as well but again no effect.
public Form1() { //the following code has no effect BSE.Windows.Forms.ProfessionalColorTable colorTable = new Office2007BlueColorTable(); BSE.Windows.Forms.PanelSettingsManager.SetPanelProperties( this.Controls, colorTable.PanelColorTable); InitializeComponent(); }
Would appreciate if someone can provide a pointer in the right direction.
Regards AKDM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, for the rendering of the controls there are two different color tables necessary.
One is located in the renderer directory. It inherits from System.Windows.Forms.ProfessionalColorTable and provides the colors used by the MS display elements.
The other color table is located in the XPander directory. It inherits from BSE.Windows.Forms.PanelColors and provides the colors used by the BSE.Windows.Forms elements.
The property PanelColorTable in class Office2007BlueColorTable does the mapping between the PanelColorTable and Office2007BlueColorTable.
public class Office2007BlueColorTable : BSE.Windows.Forms.OfficeColorTable { public override PanelColors PanelColorTable { get { if (this.m_panelColorTable == null) { this.m_panelColorTable = new PanelColorsOffice2007Blue(); } return this.m_panelColorTable; } } }
For the use of the PanelColors table at runtime there is an example at Form2.cs in the demo app.
Regards Uwe
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Thanks ! I worked this days just for an, what you already done, xpanderpanel But yours work is done, much better and complete than mine ! So Thanks very ... !
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
 | Thanks  stevesupervillain | 6:08 9 Mar '09 |
|
|
 |
|
 |
If set Autoscroll=true in your derived panel the redrawing is not quite right. Actually I guess its not quite right in general as the vertical scroll bar is next to the caption and is still showing even when collapsed.
No biggie you can put a regular panel inside the panel and it behaves nicely.
Other than that its looking good. Thanks
|
| Sign In·View Thread·PermaLink | 5.00/5 |
|
|
|
 |
|
 |
FOR THE AUTHOR OF CONTROL XPANDER, ED ASKED POSSIBLE USE FREE XPANDER CONTROL IN BUSINESS PROGRAMS(A FREE) THANK YOU.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
First of all, great job on this control.
I am saving the panel positions on close and restoring the values on open for my app, and ran into (I think) a bug in the code, that was causing OnClose to be fired when only OnExpand should have been fired.
Line 494 of BasePanel.cs should be ELSE IF instead of IF (I believe). These 2 rectangles shouldn't be on top of each other, but they appear to be if you programmatically set Expand = true on startup.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Tom,
in the Panel.OnCreateControl Method, I save the RestoreBounds values. These RestoreBounds values are necessary for the panel if it's state changes from collapse to expand.
If you sets the Panel.Expand property in the form constructor, the Panel.OnCreateControl event is not yet raised. You have to set the Panel.Expand property in the Form.Load event. Then it should work
Example
public partial class Form1 : Form { private FormSettings m_formSettings;
public Form1() { InitializeComponent(); }
private void Form1_Load(object sender, EventArgs e) { this.m_formSettings = new FormSettings();
bool bPanel1Expand = this.m_formSettings.Panel1Expand; if (bPanel1Expand == false) { panel1.Width = this.m_formSettings.Panel1Bounds.Width; panel1.Expand = bPanel1Expand; } else { if (this.m_formSettings.Panel1Bounds != Rectangle.Empty) { panel1.Width = this.m_formSettings.Panel1Bounds.Width; } } panel1.Visible = this.m_formSettings.Panel1Visible; }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (this.m_formSettings != null) { bool bExpandPanel1 = panel1.Expand; this.m_formSettings.Panel1Expand = panel1.Expand; this.m_formSettings.Panel1Visible = panel1.Visible; if (bExpandPanel1 == false) { this.m_formSettings.Panel1Bounds = panel1.RestoreBounds; } else { this.m_formSettings.Panel1Bounds = panel1.ClientRectangle; } this.m_formSettings.Save(); } } }
public class FormSettings : ApplicationSettingsBase { [UserScopedSetting()] [DefaultSettingValue("true")] public bool Panel1Expand { get { return ((bool)this["Panel1Expand"]); } set { this["Panel1Expand"] = (bool)value; } } [UserScopedSetting()] [DefaultSettingValue("true")] public bool Panel1Visible { get { return ((bool)this["Panel1Visible"]); } set { this["Panel1Visible"] = (bool)value; } } [UserScopedSetting()] public Rectangle Panel1Bounds { get { if (this["Panel1Bounds"] == null) { return Rectangle.Empty; } else { return ((Rectangle)this["Panel1Bounds"]); } } set { this["Panel1Bounds"] = (Rectangle)value; } } }
Regards Uwe
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I have found some commercial production which supports docking and drag-drop, how about this toolkit support those features?
Please pardon my weak English!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Sir,I need a lower version for my vs 2003 Applications ,Can u help me ? send me please! 13714008282@139.com
|
| Sign In·View Thread·PermaLink | 1.80/5 |
|
|
|
 |
|
 |
Is there anyway i can expand multiple panels in one list at the same time (instead of only allowing one panel open at a time). I tried modifying the Expand function and it semi worked, that is, in the designer i could see that the panels had expanded beyond the size of the List control but the headers weren't drawn in the right place and i couldn't scroll down to view it or make the first panel any smaller to view the others.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
there is no way to expand multiple xpanderpanels in the same xpanderpanellist. But you can expand more than one panel in its parent control. One panel must have the dockstyle DockStyle.Fill and all the others have the dockstyles top, bottom, right or left. In the demoproject the panels panel4, panel6 and panel5 hosted on an System.Windows.Forms panel use this feature.
Regards Uwe
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
First, thank you Uwe Eichkorn for some great work. I have a great base model to learn component control design.
I converted The C# code to VB code. Although there should be great symetry between the C# and VB code in most of the classes, some areas of code required either a slightly differnt approach or a full re-write to work correctly.
I have the code working, however there may still need to be a bug or two to be resolved.
Anyone who wants it is welcomed to it.
If anyone is interested in the conversion of these controls in a VB source format, please respond to this message. I'll check back to see if people are interested; I'll upload it and post a link to the source.
Thank's Again Uwe Eichkorn, Bill BartSystems
-----------------------------------------------------------------
My goal is to modify the code in a way that allows the panels to temporarily popup to show their contents when they have been collapsed and the mouse hovers over the caption bar.
Also,I plan to add additional controls to handle the tabcontrol & tabpages to achieve a tab docking effect.
revised 7/8/08 Zipfile link below http://home.comcast.net/~bartsystems1/htmldocs/Expander Controls in VB Download Page.htm
BartSystems Software Components Engineering
modified on Tuesday, July 8, 2008 8:09 AM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|