Click here to Skip to main content
15,885,767 members
Articles / Programming Languages / C#
Article

Collapsible Panel

Rate me:
Please Sign up or sign in to vote.
2.82/5 (9 votes)
11 Jan 2005 67.5K   1.6K   40   6
A collapsible panel user control.

Sample Image

Introduction

Ever ran out of screen area to display all of the form widgets? Here's the solution, a control to manage your user interface widgets. A two state control container that expands and shrinks, giving a tidy effect to the UI.

Image 2

Image 3

Using the code

  1. Add CollapsablePanel.cs to your project or add the assembly to your project references.
  2. Open the host form in design view, drag and drop the control on the form.
  3. Drop all of the widgets required onto a panel (System.Windows.Forms.Panel).
  4. Arrange the widgets and set the "ContentPane" property of the control to the panel you made.
  5. Set the "Button_Text" for the caption text, "Animation_Rate", and "ContentPane_HEIGHT" (maximum height for the content pane).

Image 4

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Pakistan Pakistan
Had been programming for the last 6years, experience in C, C#, JAVA, J2EE, SQL, OpenGL, TAPI. Currently working as a .NET(C#) developer at F3 Technologies, Pakistan. Areas of interests are User Interface design, desktop application programming.

Comments and Discussions

 
GeneralCannot add a panel to the contenpane Pin
walaa anwar11-Jul-10 4:53
walaa anwar11-Jul-10 4:53 
GeneralRe: Cannot add a panel to the contenpane Pin
Sufian Mehmood Sheikh11-Jul-10 21:37
Sufian Mehmood Sheikh11-Jul-10 21:37 
GeneralRe: Cannot add a panel to the contenpane Pin
walaa anwar12-Jul-10 22:54
walaa anwar12-Jul-10 22:54 
GeneralBug with Animation_Rate=1 Pin
mav.northwind12-Jan-05 6:54
mav.northwind12-Jan-05 6:54 
Hi!

There's a bug in your Panel when Animation_Rate is set to 1:
Trying to collapse the panel freezes the application while the panel is shrunk and expanded by 1 pixel indefinitely!

I'm afraid to say the rest of your code could be better, too.
Reworking your control could give you better votes...

Regards,
mav
GeneralRe: Bug with Animation_Rate=1 Pin
Sufian Mehmood Sheikh14-Jan-05 2:03
Sufian Mehmood Sheikh14-Jan-05 2:03 
GeneralRe: Bug with Animation_Rate=1 Pin
mav.northwind14-Jan-05 2:36
mav.northwind14-Jan-05 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.