try this way
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
panel1.Dock = DockStyle.Fill;
}
private void panel1_DoubleClick(object sender, EventArgs e)
{
if (this.WindowState != FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Maximized;
this.FormBorderStyle = FormBorderStyle.None;
}
else
{
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = FormBorderStyle.Fixed3D;
}
}
}