Touch screen browser-change the display resolution and refresh frequency in Windows

Source: Internet
Author: User

In Windows, you can implement different resolutions for different users.

First, create a C # program that can change the screen resolution. The source code is as follows:

1. Create a Windows application project named resolution
2. paste the code of each file:
Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. text;
Using system. Windows. forms;

Using system. runtime. interopservices;
Namespace resolution
{
Public partial class form1: Form
{
Public form1 ()
{
Initializecomponent ();
}
Public Enum dmdo
{
Default = 0,
D90 = 1,
D180 = 2,
D270 = 3
}

[Structlayout (layoutkind. Sequential, charset = charset. Auto)]
Struct devmode
{
Public const int dm_displayfrequency = 0x400000;
Public const int dm_pelswidth = 0x80000;
Public const int dm_pelsheight = 0x100000;
Private const int cchdevicename = 32;
Private const int cchformname = 32;

[Financialas (unmanagedtype. byvaltstr, sizeconst = cchdevicename)]
Public String dmdevicename;
Public short dmspecversion;
Public short dmdriverversion;
Public short dmsize;
Public short dmdriverextra;
Public int dmfields;

Public int dmpositionx;
Public int dmpositiony;
Public dmdo dmdisplayorientation;
Public int dmdisplayfixedoutput;

Public short dmcolor;
Public short dmduplex;
Public short dmyresolution;
Public short dmttoption;
Public short dmcollate;
[Financialas (unmanagedtype. byvaltstr, sizeconst = cchformname)]
Public String dmformname;
Public short dmlogpixels;
Public int dmbitsperpel;
Public int dmpelswidth;
Public int dmpelsheight;
Public int dmdisplayflags;
Public int dmdisplayfrequency;
Public int dmicmmethod;
Public int dmicmintent;
Public int dmmediatype;
Public int dmdithertype;
Public int dmreserved1;
Public int dmreserved2;
Public int dmpanningwidth;
Public int dmpanningheight;
}

[Dllimport ("user32.dll", charset = charset. Auto)]
// Static extern int changedisplaysettings (devmode lpdevmode, int dwflags );

Static extern int changedisplaysettings ([in] ref devmode lpdevmode, int dwflags );

Void changeres ()
{

Form1 T = new form1 ();
Long retval = 0;
Devmode dm = new devmode ();
DM. dmsize = (short) Marshal. sizeof (typeof (devmode ));
DM. dmpelswidth = 1024;
DM. dmpelsheight = 768;
DM. dmdisplayfrequency = 85;
DM. dmfields = devmode. dm_pelswidth | devmode. dm_pelsheight | devmode. dm_displayfrequency;
Retval = changedisplaysettings (ref DM, 0 );
}

Private void form1_load (Object sender, eventargs E)
{
Changeres ();
}

}
}

Transfer http://dev.csdn.net/article/40/40819.shtm

Http://blog.csdn.net/danielngn/archive/2004/10/05/125025.aspx

Http://www.cnblogs.com/allancandy/articles/221958.html

Source code download http://download.csdn.net/source/634828

Http://dl3.csdn.net/fd.php? I = 83236348283582 & s = 32cefa9072db31c48bc1686c6620247f

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.