I'm running Window7 64bit, RTM.
To give this application the ability to switch between a moveable frame and no frame I am using the following methods
One would expect that the size and location to remain constant, but they don't.
If I make the form Moveable(), then click maximize the form should now be 1920x1200 (Dell 24" widescreen)
But when I then make the form Fixed(), this.size() returns as 1936x1216. The reported size has grown by 16 pixel on each axis. Furthermore the location has shifted from 0,0 to -8,-8 which would be half of that 16 pixel difference.
My thinking is that since Windows7 has fancy effects like a feathered drop shadow all around the form, that the form technically extends to the edge of the drop shadow. Then when you click Maximize Windows7 is cheating and making it 16 pixels too big and offsetting by 8.
Does anyone have any better guess? Or know a way to check if there is a drop shadow visual effect so I take that into account in my size calculations?
To give this application the ability to switch between a moveable frame and no frame I am using the following methods
Code:
void Fixed() { Point pBefore = this.Location; Size sBefore = this.Size; FormBorderStyle = FormBorderStyle.None; this.BackColor = Color.FromKnownColor(KnownColor.Black); this.Location = pBefore; this.Size = sBefore; } void Moveable() { Point pBefore = this.Location; Size sBefore = this.Size; FormBorderStyle = FormBorderStyle.Sizable; this.BackColor = Color.FromKnownColor(KnownColor.Control); this.Location = pBefore; this.Size = sBefore; }
If I make the form Moveable(), then click maximize the form should now be 1920x1200 (Dell 24" widescreen)
But when I then make the form Fixed(), this.size() returns as 1936x1216. The reported size has grown by 16 pixel on each axis. Furthermore the location has shifted from 0,0 to -8,-8 which would be half of that 16 pixel difference.
My thinking is that since Windows7 has fancy effects like a feathered drop shadow all around the form, that the form technically extends to the edge of the drop shadow. Then when you click Maximize Windows7 is cheating and making it 16 pixels too big and offsetting by 8.
Does anyone have any better guess? Or know a way to check if there is a drop shadow visual effect so I take that into account in my size calculations?
Comment