C1Sizer - Ahead of its Time

In WinForms we use the Dock and Anchor properties to layout controls in certain ways so that when the form is re-sized, controls stretch to fill the form. We don't necessarily want controls to get bigger or smaller, we just want a few types of behaviors to happen:

  • Container controls grow/shrink depending on available space
  • Textboxes only grow/shrink horizontally, never vertically unless it's meant for paragraphs of text
  • Labels should not change size

Etcetera. This design requires us to set certain properties on each individual control per form. The next generation of windows development, Windows Presentation Foundation (AKA WPF), introduced a divine layout control simply called the 'Grid.' What's great about the Grid control is that we can specify the resizing capabilities of each row and column on the Grid itself, rather than on each individual control. I can't think of the technical term for that, but let's just say it's very nice. You might think the guys at Microsoft were geniuses when they rolled out this 'Grid,' but did you know ComponentOne already had this control 2 decades prior? Yes, C1Sizer, as it's currently known is very similar to the WPF Grid control. The Visual Basic version of C1Sizer (back then called Elastic) was actually the very first VideoSoft (ComponentOne prior to forming with APEX) control ever written in 1991. It's true. C1Sizer hasn't gotten any flashy new enhancements since 2008 when rounded corners were considered 'in.' It's a solid control, included in Studio for WinForms, that has plateaued in greatness. You can still get the SizerOne 8.0 in Studio for Active X too. With C1Sizer you drop it on your form like a panel, position controls inside and then turn on its 'Auto Grid' feature from the smart tag. This creates bands (row and columns) based on the child controls which will each stretch proportionally as the form is re-sized. You can fine tune the sizer's grid by fixing certain bands to prevent from resizing. It's all very easy to do right in the designer. This creates a layout that can be re-sized nicely. And it's configurable on the grid (er, C1Sizer) rather than on each individual control. Check out C1Sizer.

ComponentOne Product Manager Greg Lutz

Greg Lutz

comments powered by Disqus