Click here to Skip to main content
Licence 
First Posted 17 May 2003
Views 64,368
Bookmarked 22 times

FlowPanel

By | 17 May 2003 | Article
Horizontal-vertical layout control

Introduction

In many dialogs and forms I use internal panels, which simply layouts controls in one direction - vertical or horizontal. The most common example - OK, Cancel, Help buttons at the bottom (or at the right side) of a dialog. So I need an easy way to create such internal panel with vertical or horizontal layout.

Background

FlowPanel class extends UserControl functionality by providing custom layout implementation. This implementation layouts contained controls vertically or horizontally (direction must be predefined) into equal cells. Layout implementation takes into account Anchor and Dock styles (stretches controls in their cells according to these values).

Using the code

FlowPanel can be created with one line of code - constructor accepts panel name, layout direction, space size between controls, optional controls. Below is the example of horizontal panel with three buttons.

Button ok, cancel, help;
FlowPanel flow = new FlowPanel(
    FlowPanel.Orientations.Horizontal,
    5,
    ok=new Button(),
    cancel=new Button(),
    help=new Button());

Notes

When panel size is too small to fit all controls, layout implementation produces undetermined output. Maybe some kind of control shrinking could be applied in this case.

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

About the Author

Gytis Jakutonis



Lithuania Lithuania

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralSuggestion Pinmemberdog_spawn5:45 18 May '03  
GeneralRe: Suggestion PinmemberGytis Jakutonis20:43 18 May '03  

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

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 18 May 2003
Article Copyright 2003 by Gytis Jakutonis
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid