Form Real FullScren Question

D

Dian

Hi all, I have a following inquiry.
Here in news group I found the sample code of how to put a window form in
FullScreen (in the style VS 2003/2005 does)

protected override void OnLoad(EventArgs e)
{
base.OnLoad (e);

Point clientTL = this.PointToScreen(new Point(ClientRectangle.X,
ClientRectangle.Y));
Point clientBR = this.PointToScreen(new Point(ClientRectangle.X +
ClientRectangle.Width, ClientRectangle.Y + ClientRectangle.Height));
Point frameTL = this.Location;
Point frameBR = new Point(this.Location.X + this.Width, this.Location.Y +
this.Height);

int topXDelta = clientTL.X - frameTL.X;
int topYDelta = clientTL.Y - frameTL.Y;
int bottomXDelta = frameBR.X - clientBR.X;
int bottomYDelta = frameBR.Y - clientBR.Y;

Rectangle newFrameBounds = Screen.GetBounds(this);
newFrameBounds.Inflate(topXDelta + bottomXDelta, topYDelta +
bottomYDelta);
newFrameBounds.Location = new Point(-topXDelta, -topYDelta);

this.MaximumSize = newFrameBounds.Size;
this.MaximizedBounds= newFrameBounds;
}

But if I want that "fullscreen" behaviour to be complete how to round that
when leave "fullscreen" mode, click on maximized button of form
that from will be not in "real" maximized state - even more form will again
in "fullscreen" mode.

If anybody has any suggestions of how this is happen in VS 2003/2005 ?
 
D

Dian

Hi I have a look at that post but this is not solve the problem with hiding
task bar -
as I understand I must user FindWindow API call to get handle to taskbar and
after that
call ShowWindow (false) on that handle ... I think it is not very proper
solution cause you must engage showing taskbar again when form lostfocus -
(ALT+TAB was pressed as exmp)
even worst - if an unhandled excetion occurs when you are in "fullscreen"
mode who will show taskbar ?!?

I keep on thinking that the code I post previous is more robust but
incomplete ...
So I continue crying for help !!!
 
L

lukasz

solution cause you must engage showing taskbar again when form lostfocus -
(ALT+TAB was pressed as exmp)

OnActivate, OnDeactive
even worst - if an unhandled excetion occurs when you are in "fullscreen"
mode who will show taskbar ?!?

override default application exception
 
D

Dian

Hi Sijin

I think that this 3 line solution would not help ...
As I see in topic here
http://www.gotdotnet.com/Community/MessageBoard/Thread.aspx?id=239628
we set width and height of the form ... when we come back from "fullscreen"
mode then we have wrong values for "normal" height and width don't you think
so ?

I keep on finding the secret of MS solution - I attached to VS 2003
application with Spy ++ and I was able to find what
SendMessage/RecieveMessage sequence they use .. but still no luck .. I will
inform for that soluton
 
Top