How To Change The Screen Resolution in C#


This is a sample program that will demonstrate how to change resolution at runtime.

All programmers are facing common problem ishow to change screen Resolution dynamically. In .Net 2005 it's veryeasy to change the screen resolution. Here I will explain you how canwe get the Screen resolution and how we will change the resolution atdynamically and while unloading the page it will come as it was before.In dot net we can access the values of user's screen resolution throughthe Resolution class. It also affects all running (and minimized)programs.

Important Functions

No Functions


Screen Srn = Screen.PrimaryScreen;
tempHeight = Srn.Bounds.Width;
tempWidth = Srn.Bounds.Height;
Page.ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type="&quot;text/javascript&quot;"><!–mce:0–></script>");
//if you want Automatically Change 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);

case "1024*768":
FixHeight = 1024;
FixWidth = 768;
Resolution.CResolution ChangeRes768 = new Resolution.CResolution(FixHeight, FixWidth);
case "1280*1024":
FixHeight = 1280;
FixWidth = 1024;
Resolution.CResolution ChangeRes1024 = new Resolution.CResolution(FixHeight, FixWidth);


Download Source

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

No comments yet... Be the first to leave a reply!