Skip to content

Commit 72109a5

Browse files
authored
Merge pull request #651 from telerik/new-kb-form-titlebar-align-text-winforms-e5a935aba71b4eb9bd64ff45800739d4
Added new kb article form-titlebar-align-text-winforms
2 parents 368f118 + 8c633f1 commit 72109a5

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Aligning Text in RadTitleBar
3+
description: Learn how to change the text position in the RadTitleBar control for WinForms applications.
4+
type: how-to
5+
page_title: How to Center Text on RadTitleBar in WinForms
6+
slug: form-titlebar-align-text-winforms
7+
tags: formsanddialogs,radtitlebar, winforms, text-alignment, contentalignment, middlecenter
8+
res_type: kb
9+
ticketid: 1667619
10+
---
11+
12+
## Environment
13+
14+
|Product Version|Product|Author|
15+
|----|----|----|
16+
|2024.4.1113|RadForm/RadTitleBar for WinForms|[Dinko Krastev](https://www.telerik.com/blogs/author/dinko-krastev)|
17+
18+
## Description
19+
20+
This example demonstrates how to align the text in the title bar of a RadForm or in a stand-alone RadTitleBar control.
21+
22+
## Solution
23+
24+
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.
25+
26+
````C#
27+
28+
this.FormElement.TitleBar.CaptionElement.Alignment = ContentAlignment.MiddleCenter;
29+
30+
````
31+
32+
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.
33+
34+
````C#
35+
this.radTitleBar1.TitleBarElement.CaptionElement.Alignment = ContentAlignment.MiddleCenter;
36+
37+
```
38+
39+
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.
40+
41+
## See Also
42+
43+
* [RadTitleBar Overview](https://docs.telerik.com/devtools/winforms/controls/titlebar/overview)

0 commit comments

Comments
 (0)