Aligning Text in RadTitleBar
Environment
| Product Version | Product | Author |
|---|---|---|
| 2024.4.1113 | RadForm/RadTitleBar for WinForms | Dinko Krastev |
Description
This example demonstrates how to align the text in the title bar of a RadForm or in a stand-alone RadTitleBar control.
Solution
To center the text in the RadForm title bar, set the Alignment property of the CaptionElement to ContentAlignment.MiddleCenter. This adjustment aligns the title bar text to the middle center.
this.FormElement.TitleBar.CaptionElement.Alignment = ContentAlignment.MiddleCenter;
To center the text in the RadTitleBar as a stand-alone control, set the Alignment property of the CaptionElement to ContentAlignment.MiddleCenter. This adjustment aligns the title bar text to the middle center.
this.radTitleBar1.TitleBarElement.CaptionElement.Alignment = ContentAlignment.MiddleCenter;
By applying this code, the text in the RadTitleBar will be centered, providing a visually appealing and balanced appearance for the title bar of your WinForms application.