views:

221

answers:

2

how to maximize a windows mobile window ?

+1  A: 

By default Windows Mobile will always maximize a normal FOrm (and strip off the caption bar). If you have a non-maximized dialog, then it's being shown via ShowDialog(). If that's the case, the simplest mechanism is to just resize the Form in OnActivate to be the screen dimensions. Something along these lines:

protected override void OnActivated(EventArgs e)
{
    base.OnActivated(e);

    this.Width = Screen.PrimaryScreen.WorkingArea.Width;
    this.Height = Screen.PrimaryScreen.WorkingArea.Height;
}
ctacke
+2  A: 

You might be asking about how to make a Windows Mobile form take up the entire screen. To do this, set the form's FormBorderStyle to None, and set the WindowState to Maximized. Also, delete the menu bar if one has been automatically added by the designer.

If you're trying to make a sort of "kiosk" app that involves multiple forms, you'll run into an issue when you switch forms within the application: the start bar will flicker back up for a split second each time. There is a way around this using the Win32 API, but it's a pain.

MusiGenesis
Good point, that may be what he's after. Though I disagree about the "pain" part. A dash of Win32 is like salt - code just isn't right without it. :)http://blog.opennetcf.com/ctacke/2005/08/04/Stylin.aspx
ctacke
@ctacke: the Win32 "salt" I was talking about was using FindWindow to get a handle to the start bar and then making it invisible. This prevents it from flickering back up for a split second when you switch forms. It works great unless your app crashes and can't make it visible again, in which case the user has to do a soft reset.
MusiGenesis