From 8c633f12ee73ecff18fb79687f60a564ca83d677 Mon Sep 17 00:00:00 2001 From: KB Bot Date: Mon, 25 Nov 2024 14:06:53 +0000 Subject: [PATCH] Added new kb article form-titlebar-align-text-winforms --- .../form-titlebar-align-text-winforms.md | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 knowledge-base/form-titlebar-align-text-winforms.md diff --git a/knowledge-base/form-titlebar-align-text-winforms.md b/knowledge-base/form-titlebar-align-text-winforms.md new file mode 100644 index 000000000..4f9bb78fb --- /dev/null +++ b/knowledge-base/form-titlebar-align-text-winforms.md @@ -0,0 +1,43 @@ +--- +title: Aligning Text in RadTitleBar +description: Learn how to change the text position in the RadTitleBar control for WinForms applications. +type: how-to +page_title: How to Center Text on RadTitleBar in WinForms +slug: form-titlebar-align-text-winforms +tags: formsanddialogs,radtitlebar, winforms, text-alignment, contentalignment, middlecenter +res_type: kb +ticketid: 1667619 +--- + +## Environment + +|Product Version|Product|Author| +|----|----|----| +|2024.4.1113|RadForm/RadTitleBar for WinForms|[Dinko Krastev](https://www.telerik.com/blogs/author/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. + +````C# + +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. + +````C# +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. + +## See Also + +* [RadTitleBar Overview](https://docs.telerik.com/devtools/winforms/controls/titlebar/overview)