New to Telerik UI for WinForms? Download free 30-day trial

Item Alignment

In general case, there could be a requirement to increase the size of the title bar part of the RadToolBarForm. In this case, RadToolBarForm provides a mechanism to customize the alignment of the elements inside it. The height of the title bar can be changed by setting the CaptionHeight property.

this.radToolbarFormControl1.CaptionHeight = 60;

Me.ToolbarFormControl.CaptionHeight = 60

Figure 1: CaptionHeight Property

WinForms RadToolbarForm CaptionHeight

In Figure 1 the default alignment of all three parts (near, center, far) of the toolbar form are Top. Their alignment can be controled throught the NearItemsVerticalAligment, CenterItemsVerticalAlignment, FarItemsVerticalAligment properties.

this.radToolbarFormControl1.NearItemsVerticalAlignment = RadVerticalAlignment.Bottom;
this.radToolbarFormControl1.CenterItemsVerticalAlignment = RadVerticalAlignment.Center;
this.radToolbarFormControl1.FarItemsVerticalAlignment = RadVerticalAlignment.Stretch;

Me.ToolbarFormControl.NearItemsVerticalAlignment = RadVerticalAlignment.Bottom
Me.ToolbarFormControl.CenterItemsVerticalAlignment = RadVerticalAlignment.Center
Me.ToolbarFormControl.FarItemsVerticalAlignment = RadVerticalAlignment.Stretch

Figure 2: Vertical Alignment

WinForms RadToolbarForm Vertical Alignment

Text Position

The text position in the title bar of the control can be change throught the TextPosition property of the RadToolbarFormControl. This property is enumeration and expose four values: Near (default), CenterBefore, CenterAfter, Far.

this.radToolbarFormControl1.TextPosition = ToolbarTextPosition.CenterAfter;

Me.ToolbarFormControl.TextPosition = ToolbarTextPosition.CenterAfter

Figure 3 shows how the text will be visualize in all four options of the TextPosition property.

Figure 3: Text Position

WinForms RadToolbarForm Text Position


The RadToolbarFormControl exposes three properties to control the margins of its items sections: NearItemsMargin, CenterItemsMargin, FarItemsMargin. Their default value is: 0,8,0,8. You can use these properties to adjust the items per your needs.

this.radToolbarFormControl1.NearItemsMargin = new Padding(0,8,0,0);
this.radToolbarFormControl1.CenterItemsMargin = new Padding(100,8,0,0);
this.radToolbarFormControl1.FarItemsMargin = new Padding(0,0,0,8);

Me.ToolbarFormControl.NearItemsMargin = New Padding(0,8,0,0)
Me.ToolbarFormControl.CenterItemsMargin = New Padding(100,8,0,0)
Me.ToolbarFormControl.FarItemsMargin = New Padding(0,0,0,8)

Figure 4: Margins

WinForms RadToolbarForm Margins

See Also

In this article