The C1Elastic Control > Using C1Elastic as a Container |
To use the Elastic as a container, simply drop other controls into it at design time. The Elastic will then provide several options to label, frame, and resize its child controls.
Using the Elastic control to label its children allows you to eliminate several Label controls from your form, making it easier to create and faster to load. It also ensures that the labels will remain attached to their parent controls as you move them around the form. To label child controls, follow these steps:
Set the Tag property of each child control to the text you would like to use as a label. The text may include ampersand characters ("&") to indicate accelerator keys, just like regular labels.
Set the Elastic's TagWidth, TagPosition, and CaptionPos properties to determine the size and alignment of the labels.
That is all there is to it. You can fine-tune the labels using the TagSplit property to store additional information in the Tag property of the child controls and to control the alignment of individual labels.
Using the Elastic control to draw frames around its children is easy and allows you to enhance the appearance of your forms. To draw frames, use the Frame, FrameStyle, and FrameWidth properties to determine which children should have frames, the type and width of the frames. You can also control frame color using the FrameColor and FrameShadow properties.
To use the Elastic as a resizing container, use the two main properties offered by the control: Align and AutoSizeChildren.
The Align property determines how the Elastic should align itself to its parent control or form when it is resized. It is similar to the Align property provided by other controls such as the Picture Box control, but is more powerful because it provides an additional setting, 5 - asFill, which causes the control to fill its container, and also because it works when the Elastic is placed inside other controls, not only on forms.
The AutoSizeChildren property determines how the Elastic should align its child controls when it is resized. There are many settings available, ranging from simple (1 - szEvenHorz) to sophisticated (8 - azGrid).
These two properties are described in detail in the following topics.