The Collapsible Panel Control

The last control you'll consider is a Windows XP standby that's finally available in the .NET world. It's a CollapsiblePanel developed by Microsoft and designed to mimic the Windows XP common task pane, which is shown on the side of many standard windows (see Figure 12-7).

Vb6 Taskpane Control
Figure 12-7. The common task pane in Windows XP

This panel has several noteworthy features:

• It supports Windows XP themes, giving it a slick look with a detailed gradient background.

• It supports collapsing. When you click the arrow button in the top-right corner, the panel is reduced to just its header. You can click the arrow button again to expand the panel. In Figure 12-7, the Other Places panel is collapsed.

The .NET version of the collapsible panel duplicates this functionality (see Figure 12-8).

Collapsible Panel Windows Forms
Figure 12-8. The .NET CollapsiblePanel, expanded (left) and collapsed (right)

The CollapsiblePanel is particularly useful when generating dynamic interfaces. For example, you can stack multiple CollapsiblePanel controls one on top of the other, and dock them all to the top of the form. This ensures that as one panel collapses, all the panels underneath shift up. To get even fancier, you can put CollapsiblePanel controls in the FlowLayoutPanel (discussed in Chapter 21). Then set the FlowLayoutPanel.Margin property to add a basic amount of space between each CollapsiblePanel, and set the FlowLayoutPanel.Padding property to add some space between the FlowLayoutPanel borders and the CollapsiblePanel controls inside. With this approach, you can duplicate the look of the Windows XP common tasks pane (see Figure 12-9).

Flowlayoutpanel Resize Controls
Figure 12-9. Dynamic interfaces with the CollapsiblePanel

Although the code for the CollapsiblePanel is too long to repeat in its entirety (download the full code with the sample content for this book), it's fairly easy to pick out the important details using the concepts that you've explored in this chapter.

Was this article helpful?

+7 -2
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


  • Josefiina
    How to make collapsible panels in microsoft visual studio?
    11 months ago

Post a comment