VB 屏幕分辨率与刷新率的修改和查看
设置屏幕分辨率与刷新率打开自己做好的软件后先获取自己的分辨率于刷新率Text1.Text=自己的分辨率Text2.Text=自己的刷新率Text3.Text=自己的颜色然...
设置屏幕分辨率与刷新率
打开自己做好的软件后
先获取自己的分辨率于刷新率
Text1.Text=自己的分辨率
Text2.Text=自己的刷新率
Text3.Text=自己的颜色
然后单击Command之后
设置屏幕分辨率为Text4.Text
设置屏幕刷新率为Text5.Text
设置屏幕颜色为Text6.Text
注意:
1、不能重启后设置成功。
2、最好有解释,因为我是新手(没有也无所谓)。 展开
打开自己做好的软件后
先获取自己的分辨率于刷新率
Text1.Text=自己的分辨率
Text2.Text=自己的刷新率
Text3.Text=自己的颜色
然后单击Command之后
设置屏幕分辨率为Text4.Text
设置屏幕刷新率为Text5.Text
设置屏幕颜色为Text6.Text
注意:
1、不能重启后设置成功。
2、最好有解释,因为我是新手(没有也无所谓)。 展开
1个回答
展开全部
在窗体上画一个按钮和四个文本框,运行如下代码:启动时,显示相应数据。修改后,单击按钮改变设置。
Option Explicit
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwflags As Long) As Long
Private Const CCDEVICENAME As Long = 32
Private Const CCFORMNAME As Long = 32
Private Const DM_BITSPERPEL As Long = &H40000
Private Const DM_PELSWIDTH As Long = &H80000
Private Const DM_PELSHEIGHT As Long = &H100000
Private Const DM_DISPLAYFLAGS As Long = &H200000
Private Const DM_DISPLAYFREQUENCY = &H400000
Private Const CDS_FORCE As Long = &H80000000
Private Const BITSPIXEL As Long = 12
Private Const HORZRES As Long = 8
Private Const VERTRES As Long = 10
Private Const VREFRESH = 116
Private Type DEVMODE
dmDeviceName As String * CCDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Private Sub command1_Click()
Dim DM As DEVMODE
With DM
.dmPelsWidth = CInt(Text1.Text)
.dmPelsHeight = CInt(Text2.Text)
.dmBitsPerPel = CInt(Text3.Text)
.dmDisplayFrequency = CInt(Text4.Text)
.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT Or DM_BITSPERPEL Or DM_DISPLAYFREQUENCY
.dmSize = LenB(DM)
End With
If ChangeDisplaySettings(DM, CDS_FORCE) <> 0 Then
MsgBox "错误!不支持此模式!"
End If
End Sub
Private Sub Form_Load()
Text1.Text = GetDeviceCaps(Me.hdc, HORZRES)
Text2.Text = GetDeviceCaps(Me.hdc, VERTRES)
Text3.Text = GetDeviceCaps(Me.hdc, BITSPIXEL)
Text4.Text = GetDeviceCaps(Me.hdc, VREFRESH)
End Sub
Option Explicit
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwflags As Long) As Long
Private Const CCDEVICENAME As Long = 32
Private Const CCFORMNAME As Long = 32
Private Const DM_BITSPERPEL As Long = &H40000
Private Const DM_PELSWIDTH As Long = &H80000
Private Const DM_PELSHEIGHT As Long = &H100000
Private Const DM_DISPLAYFLAGS As Long = &H200000
Private Const DM_DISPLAYFREQUENCY = &H400000
Private Const CDS_FORCE As Long = &H80000000
Private Const BITSPIXEL As Long = 12
Private Const HORZRES As Long = 8
Private Const VERTRES As Long = 10
Private Const VREFRESH = 116
Private Type DEVMODE
dmDeviceName As String * CCDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Private Sub command1_Click()
Dim DM As DEVMODE
With DM
.dmPelsWidth = CInt(Text1.Text)
.dmPelsHeight = CInt(Text2.Text)
.dmBitsPerPel = CInt(Text3.Text)
.dmDisplayFrequency = CInt(Text4.Text)
.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT Or DM_BITSPERPEL Or DM_DISPLAYFREQUENCY
.dmSize = LenB(DM)
End With
If ChangeDisplaySettings(DM, CDS_FORCE) <> 0 Then
MsgBox "错误!不支持此模式!"
End If
End Sub
Private Sub Form_Load()
Text1.Text = GetDeviceCaps(Me.hdc, HORZRES)
Text2.Text = GetDeviceCaps(Me.hdc, VERTRES)
Text3.Text = GetDeviceCaps(Me.hdc, BITSPIXEL)
Text4.Text = GetDeviceCaps(Me.hdc, VREFRESH)
End Sub
赛麦吉
2023-06-03 广告
2023-06-03 广告
这是一张ISO12233:2000标准的分辨率测试卡,目前已被ISO12233:2014 eSFR分辨率测试卡所取代,但是目前使用ISO12233:2000标准的分辨率测试卡还是比较多。 类型 反射式:由前面照明的反射式测试标板 透射式:可...
点击进入详情页
本回答由赛麦吉提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询