My particular problem was with Windows CE.
This behavior can be seen using the CE emulator running under Visual Studio 2003.
InitializeComponent() and the onLoad event both have the
this.WindowState = FormWindowState.Maximized;
construct set.
Using the RTM version of the CF (1.0.2268.0) navigating between the two forms using the buttons causes the two forms to be always maximized.
Installing SP2 (1.0.3316.0) on the emulator and then running the same application causes the forms to be minimized on the taskbar while navigating between them and they have to be manually maximized.
The full example I wrote to illustrate this can be found here:
Problem with CF SP2 with Form navigation
After posting to the group, emails to Microsoft, formally logging the bug with Microsoft I got nowhere.
Then Alex Feiman suggested a workaround to this.
The code was:
currentForm.Hide ();
...
nextForm.Show ();
As Alex explained: "The reason the forms get minimized is because at some point you do not have a visible form and the runtime thinks you want the app hidden".
Reversing the order:
nextForm.Show ();
...
currentForm.Hide ();
stops the next form from minimising under SP2. It was never an issue with RTM.
Each form has always had the
this.WindowState = FormWindowState.Maximized;
attribute set.
Enjoy!
(Compact Framework)
No comments:
Post a Comment