A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
Go Back  Xtreme Visual Basic Talk > > > A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.


Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-2012, 03:42 PM
Gruff's Avatar
GruffA Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.


As the title suggests the attached class creates a CollapsableFlowPanel.

This is pretty cool tool as you can simply drag any control into it. Use its
"Expose" Property to toggle collapse the whole shahbang into a slim version that only exposes a title and a toggle button.

Drop any number of them into a standard LayoutFlowPanel set to "Top to bottom flow" and you've got a lot of content that takes up very little desktop space.

It has a few small behaviors I need to work out though. One issue is that when the title is set to center aligned and the control is expanded everything adjusts to the left per layout flow behavior. results in the title shifting to the left. Not sure if this is bug or a feature. (See Attachments)
I purposely made the backgrounds a different color so you can see what is happening.

Anyway give it a try. It might be useful to you.

Cheers,

~Tom
Attached Images
File Type: png ExpandableFlowPanel_Left Aligned Title.png (22.6 KB, 13 views)
File Type: png ExpandableFlowPanel_Center Aligned Title.png (32.1 KB, 9 views)
Attached Files
File Type: txt CollapsableFlowPanel.txt (9.0 KB, 8 views)
__________________
Burn the land and boil the sea
You can't take the sky from me


~T

Last edited by Gruff; 10-26-2012 at 03:51 PM.
Reply With Quote
  #2  
Old 10-26-2012, 06:04 PM
hDC_0A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 559
Default Flow Panel - Gruff_styled

Quote:
As the title suggests the attached class creates a CollapsableFlowPanel.
Thanks for sharing Gruff, but is this code meant to be in a separate class file or is the code supposed to be usable pasted into a form code window?

I tried opening up a new VB.Net Express 2010 project and pasting it into the code window for the form and
end up getting a number of errors and one warning (see attached screenshot).

Quote:
Warning:
Public Sub New()' in designer-generated type 'FlowPanelGruff.CollapsableFlowPanel' should call InitializeComponent method

Errors:
1.) WrapContents' is not a member of 'FlowPanelGruff.CollapsableFlowPanel'
2.) Base class 'System.Windows.Forms.FlowLayoutPanel' specified for class 'CollapsableFlowPanel' cannot be different from
the base class 'System.Windows.Forms.Form' of one of its other partial types
3.) FlowDirection' is not a member of 'FlowPanelGruff.CollapsableFlowPanel'.
Edit1:
Here's how to clear the errors:
1.) Make sure you have at least one FlowLayoutPanel (from the "Containers" section of the Toolbox --not in Common Controls)
dropped onto your form before pasting it the code
2.) Do not paste over the following lines:
Code:
Public Class Form1

End Class
(instead paste the class code after these lines, but the Imports statements, of course, go before these lines).
3.) Click on the FlowLayoutPanel to select it, then from the topmost twisty triangle section of the Toolbox (labelled something like "projectname Components") you'll find a CollapsibleFlowPanel control to add as a child to the FlowLayoutPanel.
4.) With the Form Designer tab selected, click on the form and under the Properties Window drop down the the controls list to see "CollapsableFlowPanel1".

Note: With nothing inside it the CollapsibleFlowLayout panel looks like a sliver in the top left most corner of the FlowLayoutPanel but is barely visible
5.) In order to "see" the CollapsibleFlowPanel you have to add something into it to "push" it open to take up some space, so add a button.

I will attach a working solution/project to save everyone a lot of hassle and fussing around in the VB.Net IDE if they want to play around with this new component.
Attached Images
File Type: jpg FlowPanel_VB_dot_Net_Express_2010_Errors-n-Warnings_screenshot.JPG (164.7 KB, 4 views)
Attached Files
File Type: zip FlowPanelGruff.zip (13.9 KB, 1 views)

Last edited by hDC_0; 10-26-2012 at 06:52 PM.
Reply With Quote
  #3  
Old 10-26-2012, 06:30 PM
Gruff's Avatar
GruffA Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

The attached code is for creating a derived class. (It inherits from the LayoutFlowPanel control)

You can either create it as a class file in a class library or do what I do when I develop a class. Add it to a standard winforms project as a new class file. It makes testing and debugging easier.

1) Open a new standard winforms project.
2) Right mouse on the project file in the project tree and select "Add" then "Class"
3) Edit the class name to be "CollapsableFlowPanel" and click "OK"

4) Double click the new class in the project browser to open its Code window.
5) Delete any automatically generated code it may contain.
6) Paste the code from my attached text file into it.

7) Build and Save the entire project.
After you build the project the "CollapsableFlowPanel" control will be in your toolbox for this project.

8) Draw it on your form like you would a Panel or GroupBox control.
9) Drop other controls into it. They will stack up vertically.

10) Select the CollapsableFlowPanel Control again and in its properites double click on the "Expose" property. The control should contract to show only its title and toggle button. (+)

Run the project. click on the + button on the control It will expand to show its contents. Click on the - button and it will contract again.

The idea is that you can place a number of these controls inside a standard LayoutFlowPanel control. Set it FlowDirection Property to "Top to Bottom" and
"Wrap" to False.

Not unlike an inch worm the entire contents of the LayoutFlowPanel will grow or shrink
depending on your +/- selections. A vertical scroll bar will allow you to reach any sub/sub component.

I am sure you have seen this behavior in other Microsoft products. Usually they have a double down or double up arrow icon instead of (+/-).

The new control contains many properties to allow you to change the look of the header. Font, Color, Symbols, Text, etc...
__________________
Burn the land and boil the sea
You can't take the sky from me


~T

Last edited by Gruff; 10-26-2012 at 06:38 PM.
Reply With Quote
  #4  
Old 10-26-2012, 06:53 PM
hDC_0A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 559
Default Oh and I forgot to ask..

Also - what exactly is this a solution for?
For instance..what design issue is it meant to solve and/or how do you see it being used?

Possibly..might it be used in place of a flyout or an Outlook style sidebar panel?

Last edited by hDC_0; 10-26-2012 at 06:59 PM.
Reply With Quote
  #5  
Old 10-26-2012, 08:02 PM
Gruff's Avatar
GruffA Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Sure. Why not.

Where I've seen it used a lot is for help text where you see a list of topics.
Click the plus sign or arrow and just that section grows pushing all the topics below lower, even if one or more of them are also expanded. Sometimes they also have
buttons or other controls inside these hidden areas to allow you to have a more interactive help session.
"Show Me" buttons etc...

Anywhere you want to really compress a complex interface and time is not a huge factor.
It is more Web pagey in feel I guess.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
  #6  
Old 10-27-2012, 09:33 AM
Gruff's Avatar
GruffA Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Sorry. Never seen an Outlook sidebar.

One way to think of these two controls it is like they are similar to a tab control.

You could also set the parent FlowLayoutPanel FlowDirection to horizontal for a different experience.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
  #7  
Old 10-29-2012, 04:16 PM
Gruff's Avatar
GruffA Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Added an indent feature so if multiple controls are nested you get a sort of menu bar experience. Pardon my sample it isn't real of course. It is just meant to give you an idea of what you can do with this sort of interface. i.e. Expose only what you need to see incrementally and work with child, grandchild controls.
Attached Images
File Type: png Sample1.png (28.1 KB, 8 views)
File Type: png Sample2.png (30.7 KB, 9 views)
File Type: png Sample3.png (34.4 KB, 9 views)
File Type: png Sample4.png (39.3 KB, 10 views)
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel. A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
 
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
A Custom CollapsableFlowPanel for use as a child of a LayoutFlowPanel.
 
-->