xinyan's WebLog

another tip - creating a maximized form on Pocket PC

Do you know how to create a maximized form (a form without title and occupies the whole screen area) in a Pocket PC application using .Net Compact Framework 1.1?

There are couple properties you need to set to get it work. First, make sure the following properties are set inside InitializeComponent() or form's constructor:

        form.Menu = null;

        form.FormBorderStyle = FormBorderStyle.None;

Secondly, in form.Load event handler, set form.WindowState = FormWindowState.Maximized

This will give you a maximized form. Here is sample code:

public class Form1 : System.Windows.Forms.Form

{

public Form1()

{

InitializeComponent();

}

protected override void Dispose( bool disposing )

{

base.Dispose( disposing );

}

#region Windows Form Designer generated code

private void InitializeComponent()

{

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

this.Text = "Form1";

this.Load += new System.EventHandler(this.Form1_Load);

}

#endregion

private void Form1_Load(object sender, System.EventArgs e)

{

this.WindowState = FormWindowState.Maximized;

}

}

Hope this helps.

Published Sunday, February 08, 2004 11:47 PM by xinyan

Comments

 

Karlitos said:

.Net Compact Framework Version 1.1?
July 13, 2004 10:50 AM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker