Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Page_Load Code
Screen Srn = Screen.PrimaryScreen;
tempHeight = Srn.Bounds.Width;
tempWidth = Srn.Bounds.Height;
Page.ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script
type=\"text/javascript\">alert('" + "Your Current Resolution is = " +
tempHeight + " * " + tempWidth + "');</script>");
//if you want Automatically Change res.at page load. please uncomment this
code.
if (tempHeight == 600)//if the system is 800*600 Res.then change to
{
FixHeight = 768;
FixWidth = 1024;
Resolution.CResolution ChangeRes = new Resolution.CResolution(FixHeight,
FixWidth);
}
Change Resoultion
switch (cboRes.SelectedValue.ToString())
{
case "800*600":
FixHeight = 800;
FixWidth = 600;
Resolution.CResolution ChangeRes600 = new
Resolution.CResolution(FixHeight, FixWidth);
break;
case "1024*768":
FixHeight = 1024;
FixWidth = 768;
Resolution.CResolution ChangeRes768 = new
Resolution.CResolution(FixHeight, FixWidth);
break;
case "1280*1024":
FixHeight = 1280;
FixWidth = 1024;
Resolution.CResolution ChangeRes1024 = new
Resolution.CResolution(FixHeight, FixWidth);
break;
}
I would think that to change the screen resolution in a Windows app., you'd
need to access a Windows API.
-Scott
"Ed Hochberg" <EdHoc...@discussions.microsoft.com> wrote in message
news:6F9C4CED-AF25-44D2...@microsoft.com...
Call the native function ChangeDisplaySettingsEx via DllImport etc..
Arne
That's the worst code I've seen for a while at least. :-)
Arne showed you the Windows API call to change the screen resolution,
but please don't do that! The user has set their resolution to what
they like and you should not change it! You might have the intent of
changing it back when you are through, but if your program crashes,
then the user will have to change it back manually.
Generally speaking, it is bad form to change any of the user's desktop
settings.
I can not see any need to change it either.
But the original poster must have had some idea with it.
Arne
It may be for something like a video game, where there is an "Options"
section that allows the user to change resolution for the duration of the
game. It could be that the resolution change is actually initiated by the
user of the program and then the program returns the resolution back to its
original state when the program exits.
You are both right that this shouldn't be done without the user's consent,
but there may well be perfectly acceptable reasons to do it with the user's
concent.
-Scott