How to create a form with a border, but no title bar? (like volume control on Windows 7)

form.Text = string.Empty;
form.ControlBox = false;
form.FormBorderStyle = FormBorderStyle.SizableToolWindow;

For a fixed size window, you should still use FormBorderStyle.SizableToolWindow, but you can override the form’s WndProc to ignore non-client hit tests (which are used to switch to the sizing cursors):

protected override void WndProc(ref Message message)
{
    const int WM_NCHITTEST = 0x0084;

    if (message.Msg == WM_NCHITTEST)
        return;

    base.WndProc(ref message);
}

If you want to really enforce the size, you could also set MinimumSize equal to MaximumSize on the form.

Leave a Comment