From 335a3ef7e9806b7bafe98d02787a1724b8f199d0 Mon Sep 17 00:00:00 2001 From: Nadya Todorova Date: Fri, 31 Oct 2025 12:13:39 +0200 Subject: [PATCH 1/5] New KB --- knowledge-base/titlebar-on-form.md | 108 +++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 knowledge-base/titlebar-on-form.md diff --git a/knowledge-base/titlebar-on-form.md b/knowledge-base/titlebar-on-form.md new file mode 100644 index 000000000..e0b490d9c --- /dev/null +++ b/knowledge-base/titlebar-on-form.md @@ -0,0 +1,108 @@ +--- +title: Use RadTitleBar on a standart MS Form/RadForm +description: This article demonstrates how to use RadTitle on standart MS Form/RadForm. +type: how-to +page_title: Use RadTitleBar on a standart MS Form/RadForm +slug: titlebar-on-form +position: 0 +tags: titlebar, forms, minimize, maximize, winforms +res_type: kb +--- + +## Environment + +|Product Version|Product|Author| +|----|----|----| +|2025.3.812|RadTitleBar for WinForms|[Nadya Karaivanova](https://www.telerik.com/blogs/author/nadya-karaivanova)| + +## Description + +The standart Form as well as RadForm, do provide their own title bar integrated in the form. However, a common requirement is to want to customize the bottons on the form, or change their behavior, etc. Here comes [RadTitleBar](https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/radtitlebar/radtitlebar) that allows to be fully customized. + +## Solution + +To use RadTitleBar on a standart Form or RadForm, and achieve the same behavior when minimizing/maximizing the form you need to override the `WndProc()` as shown below: + +A full code snippet is illustrated below. You can use the following approach for either [MS Form](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.form?view=windowsdesktop-9.0) or [RadForm](https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/form/form). + + +````C# +public partial class Form1 : Form +{ + public Form1() + { + InitializeComponent(); + //remove title bar of existing Form + this.ControlBox = false; + this.FormBorderStyle = FormBorderStyle.None; + + //Add RadTitleBar + RadTitleBar radTitleBar = new Telerik.WinControls.UI.RadTitleBar(); + radTitleBar.Dock = DockStyle.Top; + this.Controls.Add(radTitleBar); + + } + + protected override void WndProc(ref Message m) + { + if (m.Msg == NativeMethods.WM_GETMINMAXINFO) + { + NativeMethods.MINMAXINFO info = (NativeMethods.MINMAXINFO)Marshal.PtrToStructure(m.LParam, typeof(NativeMethods.MINMAXINFO)); + + if (this.Parent == null) + { + Screen scr = Screen.FromControl(this); + Rectangle workingArea = scr.WorkingArea; + Rectangle screenRect = scr.Bounds; + + info.ptMaxSize.x = workingArea.Width; + info.ptMaxSize.y = workingArea.Height; + info.ptMaxPosition.x = workingArea.X - screenRect.X; + info.ptMaxPosition.y = workingArea.Y - screenRect.Y; + Marshal.StructureToPtr(info, m.LParam, false); + } + } + + base.WndProc(ref m); + } +} + +```` +````VB.NET +Public Partial Class Form1 + Inherits Form + + Public Sub New() + InitializeComponent() + ' remove title bar of existing Form + Me.ControlBox = False + Me.FormBorderStyle = FormBorderStyle.None + + ' Add RadTitleBar + Dim radTitleBar As RadTitleBar = New Telerik.WinControls.UI.RadTitleBar() + radTitleBar.Dock = DockStyle.Top + Me.Controls.Add(radTitleBar) + End Sub + + Protected Overrides Sub WndProc(ByRef m As Message) + If m.Msg = NativeMethods.WM_GETMINMAXINFO Then + Dim info As NativeMethods.MINMAXINFO = CType(Marshal.PtrToStructure(m.LParam, GetType(NativeMethods.MINMAXINFO)), NativeMethods.MINMAXINFO) + + If Me.Parent Is Nothing Then + Dim scr As Screen = Screen.FromControl(Me) + Dim workingArea As Rectangle = scr.WorkingArea + Dim screenRect As Rectangle = scr.Bounds + info.ptMaxSize.x = workingArea.Width + info.ptMaxSize.y = workingArea.Height + info.ptMaxPosition.x = workingArea.X - screenRect.X + info.ptMaxPosition.y = workingArea.Y - screenRect.Y + Marshal.StructureToPtr(info, m.LParam, False) + End If + End If + + MyBase.WndProc(m) + End Sub +End Class + +```` + From 489884de792a63518b3ebdbe24ea7b968c878d0a Mon Sep 17 00:00:00 2001 From: Nadya Todorova <48494959+nade7o@users.noreply.github.com> Date: Fri, 31 Oct 2025 12:17:11 +0200 Subject: [PATCH 2/5] Update titlebar-on-form.md --- knowledge-base/titlebar-on-form.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/knowledge-base/titlebar-on-form.md b/knowledge-base/titlebar-on-form.md index e0b490d9c..8d5ad53e8 100644 --- a/knowledge-base/titlebar-on-form.md +++ b/knowledge-base/titlebar-on-form.md @@ -1,8 +1,8 @@ --- -title: Use RadTitleBar on a standart MS Form/RadForm +title: How to use RadTitleBar on a standard MS Form/RadForm description: This article demonstrates how to use RadTitle on standart MS Form/RadForm. type: how-to -page_title: Use RadTitleBar on a standart MS Form/RadForm +page_title: How to use RadTitleBar on a standard MS Form/RadForm slug: titlebar-on-form position: 0 tags: titlebar, forms, minimize, maximize, winforms From 166332b6c2c94affa42c54e5be71b67a43d4b80b Mon Sep 17 00:00:00 2001 From: Nadya Todorova <48494959+nade7o@users.noreply.github.com> Date: Fri, 31 Oct 2025 12:17:44 +0200 Subject: [PATCH 3/5] Update titlebar-on-form.md --- knowledge-base/titlebar-on-form.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/knowledge-base/titlebar-on-form.md b/knowledge-base/titlebar-on-form.md index 8d5ad53e8..e29b3d462 100644 --- a/knowledge-base/titlebar-on-form.md +++ b/knowledge-base/titlebar-on-form.md @@ -1,6 +1,6 @@ --- title: How to use RadTitleBar on a standard MS Form/RadForm -description: This article demonstrates how to use RadTitle on standart MS Form/RadForm. +description: This article demonstrates how to use RadTitle on a standard MS Form/RadForm. type: how-to page_title: How to use RadTitleBar on a standard MS Form/RadForm slug: titlebar-on-form @@ -17,11 +17,11 @@ res_type: kb ## Description -The standart Form as well as RadForm, do provide their own title bar integrated in the form. However, a common requirement is to want to customize the bottons on the form, or change their behavior, etc. Here comes [RadTitleBar](https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/radtitlebar/radtitlebar) that allows to be fully customized. +The standard Form as well as RadForm do provide their own title bar integrated in the form. However, a common requirement is to want to customize the bottons on the form, or change their behavior, etc. Here comes [RadTitleBar](https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/radtitlebar/radtitlebar) that allows to be fully customized. ## Solution -To use RadTitleBar on a standart Form or RadForm, and achieve the same behavior when minimizing/maximizing the form you need to override the `WndProc()` as shown below: +To use RadTitleBar on a standard Form or RadForm, and achieve the same behavior when minimizing/maximizing the form, you need to override the `WndProc()` as shown below: A full code snippet is illustrated below. You can use the following approach for either [MS Form](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.form?view=windowsdesktop-9.0) or [RadForm](https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/form/form). From 33ca44ec1342e0ac93abc9986f139524d18e1a3d Mon Sep 17 00:00:00 2001 From: Nadya Todorova <48494959+nade7o@users.noreply.github.com> Date: Fri, 31 Oct 2025 12:18:03 +0200 Subject: [PATCH 4/5] Update titlebar-on-form.md --- knowledge-base/titlebar-on-form.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledge-base/titlebar-on-form.md b/knowledge-base/titlebar-on-form.md index e29b3d462..7b61d5063 100644 --- a/knowledge-base/titlebar-on-form.md +++ b/knowledge-base/titlebar-on-form.md @@ -17,7 +17,7 @@ res_type: kb ## Description -The standard Form as well as RadForm do provide their own title bar integrated in the form. However, a common requirement is to want to customize the bottons on the form, or change their behavior, etc. Here comes [RadTitleBar](https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/radtitlebar/radtitlebar) that allows to be fully customized. +The standard Form as well as RadForm do provide their own title bar integrated in the form. However, a common requirement is to want to customize the buttons on the form, or change their behavior, etc. Here comes [RadTitleBar](https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/radtitlebar/radtitlebar) that allows to be fully customized. ## Solution From 2335dde924f3f53715d4e1f8c9890bc9738d0950 Mon Sep 17 00:00:00 2001 From: Dinko Krastev Date: Fri, 31 Oct 2025 12:38:06 +0200 Subject: [PATCH 5/5] Update titlebar-on-form.md --- knowledge-base/titlebar-on-form.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/knowledge-base/titlebar-on-form.md b/knowledge-base/titlebar-on-form.md index 7b61d5063..a00dc9a03 100644 --- a/knowledge-base/titlebar-on-form.md +++ b/knowledge-base/titlebar-on-form.md @@ -5,7 +5,7 @@ type: how-to page_title: How to use RadTitleBar on a standard MS Form/RadForm slug: titlebar-on-form position: 0 -tags: titlebar, forms, minimize, maximize, winforms +tags: formsanddialogs,titlebar, forms, minimize, maximize, winforms res_type: kb --- @@ -17,7 +17,7 @@ res_type: kb ## Description -The standard Form as well as RadForm do provide their own title bar integrated in the form. However, a common requirement is to want to customize the buttons on the form, or change their behavior, etc. Here comes [RadTitleBar](https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/radtitlebar/radtitlebar) that allows to be fully customized. +The standard Form as well as RadForm do provide their own title bar integrated in the form. However, a common requirement is to want to customize the buttons on the form, or change their behavior, etc. Here comes [RadTitleBar](https://docs.telerik.com/devtools/winforms/controls/forms-and-dialogs/radtitlebar/radtitlebar) that allows it to be fully customized. ## Solution @@ -27,6 +27,7 @@ A full code snippet is illustrated below. You can use the following approach for ````C# + public partial class Form1 : Form { public Form1() @@ -69,6 +70,7 @@ public partial class Form1 : Form ```` ````VB.NET + Public Partial Class Form1 Inherits Form