Click here to Skip to main content
15,891,513 members
Articles / Programming Languages / C#

XPanderControls

Rate me:
Please Sign up or sign in to vote.
4.93/5 (106 votes)
27 Nov 2008CPOL3 min read 283.6K   29.2K   378  
Outlook 2007 styled expandable and collapsible panels and panel collections for grouping collections of controls.
using System;
using System.Text;
using System.Windows.Forms;

namespace BSE.Windows.Test
{
    public class Form2 : Form
    {
        private BSE.Windows.Forms.Panel panel1;
        
        public Form2()
        {
            // Create and initialize a Panel.
            this.panel1 = new BSE.Windows.Forms.Panel();
            this.panel1.Text = "panel1";
            // Set the panel background.
            this.panel1.ShowTransparentBackground = false;
            // Set the panel's DockStyle to DockStyle.Fill
            this.panel1.Dock = DockStyle.Fill;
            // Add the panel to the form
            this.Controls.Add(this.panel1);

            // Create and initialize a ToolStripProfessionalRenderer.
            ToolStripProfessionalRenderer renderer = new BSE.Windows.Forms.Office2007Renderer();
            // Add it to the ToolStripManager.Renderer
            ToolStripManager.Renderer = renderer;

            // Get the ProfessionalColorTable colorTable for the current renderer.
            BSE.Windows.Forms.ProfessionalColorTable colorTable = renderer.ColorTable as BSE.Windows.Forms.ProfessionalColorTable;
            if (colorTable != null)
            {
                // Get the PanelColors panelColorTable for the current  colortable.
                BSE.Windows.Forms.PanelColors panelColorTable = colorTable.PanelColorTable;
                if (panelColorTable != null)
                {
                    // Set the panel properties for the form controls collection
                    BSE.Windows.Forms.PanelSettingsManager.SetPanelProperties(this.Controls, panelColorTable);
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions