I’ve recently discovered a problem with my dotNet program. Well, as I found out, it may not be a problem with my program. I display a maximized, borderless window (#1) and then transition to a normal, sizable bordered window (#2), which is also maximized. The borderless window, when maximized, covers the taskbar, which is fine. However window #1 creates window #2, which apparently also gives window #2 a higher z-order than the task bar. When window #2 finishes loading, it sends an event to window #1, instructing it to close.
So, at first glance, window #2 seems fine. It doesn’t appear to cover the taskbar, but on closer inspection it does by just a few pixels. Even this would not be a problem until I came across a problem with my info balloon.
I am using a class I created, similar to this one I found on CodeProject. When window #2 was visible, my info balloon would disappear. Even if the window was in “restored” mode and nowhere near the balloon, it would still be gone. When I minimize the window, the balloon instantly appears. I’ve come to the conclusion that this must be due to the fact that window #2 has a higher z-order than the task bar. I’m developing on Windows 2000, so I’m not sure if this is an issue in XP too.
So, to correct the problem, I had to allow the taskbar to be visible during the display of window #1 and essentially create my own maximize function.
/* Properties for window #1 */ this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None; this->StartPosition = System::Windows::Forms::FormStartPosition::WindowsDefaultBounds; /* In Load function of window #1 */ Screen* primary = Screen::PrimaryScreen; System::Drawing::Rectangle *rect = __box(primary->WorkingArea); this->Size = rect->Size; this->Location = rect->Location;
Now, I certainly won’t claim that this is the best solution. I’m sure there must be something I can do on load of window #2 to force it below the taskbar, but I’m not sure how to get there yet. In my opinion, because window #2 is created with a sizable border, Windows should be responsible for giving it the correct z-order placement, regardless of who creates it. Please leave a comment if you’ve got some ideas.