myNIk
myNIk

Reputation: 3

How to remove the caption bar of a window in c#

I would like to remove form frame in c#

Picture: http://img251.imageshack.us/img251/9114/87017773.jpg

Anyone know how can I do this ?

Upvotes: 0

Views: 1816

Answers (3)

Jon Skeet
Jon Skeet

Reputation: 1499770

(I've added this as a second answer to make it clearer that Wallace actually got the right answer first. I had a couple of failed attempts!)

Set the FormBorderStyle property to None. Sample code:

using System;
using System.Windows.Forms;

public class Test
{
    [STAThread]
    static void Main()
    {
        Button button = new Button { Text = "Click to close" };
        Form form = new Form
        {
            Controls = { button },
            FormBorderStyle = FormBorderStyle.None,
        };
        button.Click += delegate { form.Close(); };

        Application.Run(form);
    }
}

Upvotes: 2

C. Dragon 76
C. Dragon 76

Reputation: 10052

Try Window.WindowStyle = WindowStyle.None if you're using WPF.

Upvotes: 1

Wallace Breza
Wallace Breza

Reputation: 4958

In WinForms you can set the FormBorderStyle property on the form to None.

Upvotes: 3

Related Questions