Hi All,
I'm back. Today let see how can we change the screen resolution using the C#. You might aware we can get the screen resolution in C# using the Screen class.
and we get the output -
Using the Screen class, we can get the screen resolution and size, but whats about to set the screen resolution as per the requirement.
Sometime we code in such a way we need a fix screen resolution mean to work the piece of code of whole snippet we require a size (x*y).
Using the Screen class we can verify either we have suitable environment or not but to set the environment to make the piece of code work we explicitly need to change the resolution of the screen.
I have code to change the resolution of the screen, you just need to down the DLL and you are ready to using it.
Download from here Download DLL Now.
After the downloading you are ready to go by including the dll in your project reference and you need to one line only
You can download the full sample from here. Download Full Sample.
First button to change the resolution to 1024 * 768, while the second button show the current resolution is 1152 * 864. After clicking the First button resolution would be 1024 * 768 and we can revert back to original resolution by just clicking the Second Button.
Happy Coding and Knowledge sharing..!!!
I'm back. Today let see how can we change the screen resolution using the C#. You might aware we can get the screen resolution in C# using the Screen class.
Screen Srn=Screen.PrimaryScreen; int tempWidth=Srn.Bounds.Width; int tempHeight=Srn.Bounds.Height; Console.WriteLine("Current Screen width is {0} and height is {1}.", tempWidth, tempHeight);
and we get the output -
Current Screen width is 1152 and height is 864.
Using the Screen class, we can get the screen resolution and size, but whats about to set the screen resolution as per the requirement.
Sometime we code in such a way we need a fix screen resolution mean to work the piece of code of whole snippet we require a size (x*y).
Using the Screen class we can verify either we have suitable environment or not but to set the environment to make the piece of code work we explicitly need to change the resolution of the screen.
I have code to change the resolution of the screen, you just need to down the DLL and you are ready to using it.
Download from here Download DLL Now.
After the downloading you are ready to go by including the dll in your project reference and you need to one line only
MyTactics.blogspot.com.NewResolution n = new MyTactics.blogspot.com.NewResolution(1024, 768);
You can download the full sample from here. Download Full Sample.
First button to change the resolution to 1024 * 768, while the second button show the current resolution is 1152 * 864. After clicking the First button resolution would be 1024 * 768 and we can revert back to original resolution by just clicking the Second Button.
Happy Coding and Knowledge sharing..!!!
No comments:
Post a Comment