Environment
- Windows XP SP3 x32
- Visual Studio 2005 Standard
- Windows Mobile/Pocket PC 2003
- .NET Compact Framework 1.0 SP3 and .NET Framework 1.1
- Honeywell Dolphin 9500 Handheld Barcode Scanner
Goal
I have a three form application and an external class (Program.cs) that has the application entry point, Main()
. The main form loads first and then, from within MainForm_Load(...)
, instantiates/shows a new form kind of like a splash screen. I want all three forms to be maximized. All three forms have the following properties set:
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ControlBox = false;
Problem
The "splash screen" form shows up full screen without any issue. I then dispose of it and show the main screen (first to load and the param for Application.Run();
. From the main screen, once a list box SelectedIndexChanged event is detected, a third form is shown (leaving the main form behind said third form). That third form shows the task bar over the top portion of my form:
Upon closing this form, the main form now has the task bar overlayed as well.
Code
Friend paste links. Let me know if I should just post the code here. WorkOrderView is over a thousand lines so I figured this would be easier.
- "Main" Form (WorkOrders.cs)
- "Third" Form (WorkOrderView.cs) - Pictured above
Unrelated Suggestions
I am quite a green programmer and I especially lack experience in this environment. So, if you have any suggestions/criticisms on the way I'm doing some things, don't hesitate to hit me with them. Probably best to just comment on the post instead of posting an answer for those types of replies.
What you're after is usually referred to as "kiosk mode" (which may help your search engine results).
The underlying issue is that the start bar is not part of your app - it's part of the Shell app and you're competing with it for desired behavior. What you want is something the Platform is trying to prevent you from doing, so you have to be prepared to put your developer boot on the platform's neck to get it to behave.
This blog entry is a really good starting point for this issue and will probably give you what you need, but feel free to use a search engine to find more/aternate proposals. There's actually a lot of material on the web for this - more than would belong in this answer.
First off, I only run Windows Mobile 5 (WM5) these days. (I got to move up from PocketPC 2003 a couple of years ago. LOL)
I've found that defining a Form's Window Size does not work well on mobile devices, and that showing/hiding multiple forms is awkward and never behaves the way you want.
Still, make sure your Main Form has it's
WindowState
set to Maximized.I also set
ControlBox
andMinimizeBox
to False, if that helps.Instead of using multiple forms, it will look much nicer if you simply use Panels as your forms with the Main Form as some kind of MDI container (bad choice of words, but that is what I'm doing).
In my Designer View, each panel is just a small box full of controls.
Dock
to Fill.pnl1_button1
andpnl2_button1
are easier to understand in your code than the VS defaultbutton1
andbutton2
.Dock
properties and set it back to None.I have found it also helps to maintain a small sketch of your panels with their names and the names of their controls.
In the
Load
event of your main form, set everyPanel
'sDock
property to DockStyle.Fill. Then, as you want to show one form, simply callPanel1.BringToFront()
instead ofdialog.Show()
.Mobile development isn't hard, but it is different. :)
EDIT:
In the project's Program.cs file, I keep the following static tools that I can use to turn ON and OFF the Start Menu (doesn't work so well in WM5, but I've still got it in my code from my PocketPC version).
I have not had to open this project in a year or so, but it should all be valid. Give them a try. If I've left something out, just let me know.
Once this is pasted into your project's Program.cs file, just call
Program.ShowWindowsMenu(false);
when your program starts andProgram.ShowWindowsMenu(true);
when your program exits.EDIT2:
Declare a private static instance of your main form, then wrap that in a try....catch routine inside your project's
Program.cs
file like so: