If you've done any PPC UI development you're probably aware that you cannot make a Form appear less than full screen, unless you make it borderless, which isn't terribly useful. The ability to do a popup like the MessageBox would be really useful, but actually implementing it is a bitch.
The full-screen behavior is not something enforced by the CF, but is actually enforced by the Pockety PC itself. To confirm this for yourself, simply make an app with a less-than-fullscreen Form and run it on the vanilla CE emulator. On another of my infamous commuter thinking sessions, I starting thinking about how the PPC enforces this and how to circumvent it.
My initial thought was that the PPC simply modified the window position and style to enforce the behavior and that by modifying them after the fact would be a plausible workaround.
I decided to run some quick tests this morning to confirm my suspicions. I created an app that created two Forms - one with the standard border, title bar, etc. and one that was borderless. I resized both in the designer to be less than full screen, and then I used the OpenNETCF.Win32Window class to look at the Forms' properties with GetWindowLong and move them around with SetWindowPos.
To my surprise, the style of the normal window was 0x1600 0000 - meaning it had no title bar! As confirmation, if I moved the Form with SetWindowPos , the Form's contents moved, but the title bar stayed at the top of the screen. Interesting. It seems that the PPC itself must be stripping the title bar from the Form and creating its own system-wide title bar. This actually explains some weird behavior seen in the past, such as when you close a Form and the title bar remains.
I modified the style bits and position of the "normal" form and was able to get the Form's actual title bar to appear, allowing me to drag and resize the Form, but the PPC still enforced the size of the Form on initialization. No matter what I set in the Form's ctor, it always ended up as 240x294. I could resize it manually afterward, but that wasn't desireable.
I then tried starting with a borderlesss Form and manipulating it's bits and I found that I could get it to start up in the right place with the right size. The only problem is that there seems to be a "hidden" minimize box (even though I explicitly remove it) that allow the form to be minimized by clicking in the upper left of the title bar.
By moving the manipulation code in the normal Form to an Activated event handler I got the same behavior.
So in short, I've come close - I've got a non-fullscreen form that you can move and size. The only remaining issue is to get rid of the pesky minimize button. If you want to play with it, here's the code to get you started. Start wiht a Form with no ControlBox and the BorderStyle set to none.
IntPtr hWnd = Win32Window.FindWindow(null, this.Text);
int style = Win32Window.GetWindowLong(hWnd, Win32Window.GetWindowLongParam.GWL_STYLE);
style |= (int)(
Win32Window.SetWindowLong(hWnd, (int)Win32Window.GetWindowLongParam.GWL_STYLE, style);
Win32Window.SetWindowPos(hWnd, Win32Window.SetWindowPosZOrder.HWND_TOP, 25, 25, this.Width, this.Height, Win32Window.SetWindowPosFlags.SWP_SHOWWINDOW);