tags:

views:

116

answers:

1

In our WPF applicaiton, we're using WindowStyle="None" in order to give our application a more custom look. The maximize/minimize buttons are in the same place, but styled the way we want them.

As such, we're hijacking the maximize and minimize behavior and doing it manually. We're doing the following:

this.Top = myScreen.WorkingArea.Top;
this.Left = myScreen.WorkingArea.Left;
this.Width = myScreen.WorkingArea.Width;
this.Height = myScreen.WorkingArea.Height;

Here, myScreen is the Screen where the center point of the application lies, in the event the user is running on a multi-monitor setup.

On certain setups, and with seemingly no connection, hitting the maximize button will extend the size of the application way past the actual, viewable area of the monitor. It fails this way on my and another developers setup, but my bosses multi-monitor setup it works just fine.

My monitor setup is as follows:

Monitor 2 (left)

Top, Left: 0, -1280
Resolution: 1280, 1024

Monitor 1 (right, laptop)

Top, Left: 0, 0
Resolution: 1680, 1050

When I manually resize the application to the size it should be when maximized, I get the following values:

Top, Left: 0, -1024
Height, Width: 792, 1024

I fairly recently updated the display drivers on my laptop, and no newer ones exist. Other than that I can't explain this phenomenon. Does anyone else have any experience with this? Is this perhaps a dots-per-pixel conversion issue or something? I can't find any answers from here or searching google... Any help would be greatly appreciated!

A: 

Have you seen this page - Maximizing window (with WindowStyle=None) considering Taskbar? Also, here is a developer's blog entry on a control he made that does this (hasn't released the source code yet, but claims it will be released soon).

Gabriel McAdams
Thanks! I'll see if this helps soon.
opedog
Thanks! This got it working. For some reason on my setup .NET has no idea what the size of my monitor is, but Win32 does. Go figure. Thanks again!
opedog
That is strange. I wonder what they're doing differently. I'm glad you got it working.
Gabriel McAdams