91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

C# 代碼調整屏幕分辨率

發布時間:2020-08-08 23:53:28 來源:網絡 閱讀:3162 作者:溫馨夢痕 欄目:編程語言

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace 解決分辨率
{
    public partial class Form1 : Form
    {
        //保存當前屏幕分辨率
        int i = Screen.PrimaryScreen.Bounds.Width;
int j = Screen.PrimaryScreen.Bounds.Height;
        public Form1()
        {
            InitializeComponent();
        }
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
        public struct DEVMODE
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
            public string dmDeviceName;
            public short dmSpecVersion;
            public short dmDriverVersion;
            public short dmSize;
            public short dmDriverExtra;
            public int dmFields;
            public short dmOrientation;
            public short dmPaperSize;
            public short dmPaperLength;
            public short dmPaperWidth;
            public short dmScale;
            public short dmCopies;
            public short dmDefaultSource;
            public short dmPrintQuality;
            public short dmColor;
            public short dmDuplex;
            public short dmYResolution;
            public short dmTTOption;
            public short dmCollate;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
            public string dmFormName;
            public short dmLogPixels;
            public int dmBitsPerPel;
            public int dmPelsWidth;
            public int dmPelsHeight;
            public int dmDisplayFlags;
            public int dmDisplayFrequency;
        }
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        static extern int ChangeDisplaySettings([In] ref DEVMODE lpDevMode, int dwFlags);
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        static extern bool EnumDisplaySettings(string lpszDeviceName, Int32 iModeNum, ref DEVMODE lpDevMode);
        void ChangeRes()
        {

            DEVMODE DevM = new DEVMODE();
            DevM.dmSize = (short)Marshal.SizeOf(typeof(DEVMODE));
            bool mybool;
            mybool = EnumDisplaySettings(null, 0, ref DevM);
            DevM.dmPelsWidth = 1024;//寬
            DevM.dmPelsHeight = 768;//高
            DevM.dmDisplayFrequency = 60;//刷新頻率
            DevM.dmBitsPerPel = 32;//顏色象素
            long result = ChangeDisplaySettings(ref DevM, 0);
        }
        void FuYuan()
        {
            DEVMODE DevM = new DEVMODE();
            DevM.dmSize = (short)Marshal.SizeOf(typeof(DEVMODE));
            bool mybool;
            mybool = EnumDisplaySettings(null, 0, ref DevM);
            DevM.dmPelsWidth = i;//恢復寬
            DevM.dmPelsHeight =j;//恢復高
            DevM.dmDisplayFrequency = 60;//刷新頻率
            DevM.dmBitsPerPel = 32;//顏色象素
            long result = ChangeDisplaySettings(ref DevM, 0);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            ChangeRes();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FuYuan();
            this.Close();
         
        }



向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

厦门市| 长垣县| 无棣县| 连州市| 南溪县| 池州市| 和龙市| 文昌市| 佳木斯市| 吴旗县| 运城市| 宝兴县| 丰原市| 宜阳县| 大姚县| 松桃| 井陉县| 济阳县| 屯昌县| 怀来县| 嫩江县| 盖州市| 鸡西市| 娄烦县| 定兴县| 彩票| 昂仁县| 眉山市| 富顺县| 柘荣县| 晋城| 华宁县| 乐平市| 呼伦贝尔市| 湖口县| 左云县| 襄樊市| 天津市| 浮梁县| 丹巴县| 黔南|