views:

68

answers:

3

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 ?

+3  A: 

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

Wallace Breza
+1  A: 

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

C. Dragon 76
+2  A: 

(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);
    }
}
Jon Skeet
Correct on the FormBoarderStyle and good form in showing that you need to provide a button so the user can exit your app (other than Alt+F4 or other system menu actions). Bad form on the misleading button text ;)
Tergiver
@Tergiver: Text duly changed :)
Jon Skeet