New to Telerik UI for WinFormsStart a free 30-day trial

How to use RadTitleBar on a standard MS Form/RadForm

Updated on Oct 31, 2025

Environment

Product VersionProductAuthor
2025.3.812RadTitleBar for WinFormsNadya Karaivanova

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 that allows it to be fully customized.

Solution

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 or RadForm.

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);
    }
}
   
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support