VB 屏幕分辨率 有加分!

需要在form4被激活的时候改成1024*768Form_Unload(CancelAsInteger)里面再改回来最好是可以直接复制的先谢过了有加分!怎么获得原来的分辨... 需要在form4被激活的时候改成1024*768
Form_Unload(Cancel As Integer)里面再改回来
最好是可以直接复制的
先谢过了

有加分!
怎么获得原来的分辨率呀?
不一定是800*600呀?
展开
 我来答
szdan
2009-03-22 · TA获得超过662个赞
知道小有建树答主
回答量:287
采纳率:0%
帮助的人:0
展开全部
'设置显示器分辨率
Private Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As Any) As Long
Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwFlags As Long) As Long
Const CCDEVICENAME = 32
Const CCFORMNAME = 32
Const DM_PELSWIDTH = &H80000
Const DM_PELSHEIGHT = &H100000

Const ENUM_CURRENT_SETTINGS = -1

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
Dim DevM As DEVMODE

Private Sub Form_Load()
EnumDisplaySettings 0, 0, DevM
DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
DevM.dmPelsWidth = 1024 '设定成想要的分辨率
DevM.dmPelsHeight = 768
ChangeDisplaySettings DevM, 0
End Sub

Private Sub Form_Unload(Cancel As Integer)
EnumDisplaySettings 0, 0, DevM
DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
DevM.dmPelsWidth = 800 '设回原分辨率
DevM.dmPelsHeight = 600
ChangeDisplaySettings DevM, 0
End Sub

'获取分辨率

Private Sub Command1_Click()
EnumDisplaySettings 0, ENUM_CURRENT_SETTINGS, DevM
Print DevM.dmPelsWidth & "×" & DevM.dmPelsHeight
End Sub
东莞大凡
2024-11-14 广告
标定板认准大凡光学科技,专业生产研发厂家,专业从事光学影像测量仪,光学投影测量仪.光学三维测量仪,光学二维测量仪,光学二维测量仪,光学三维测量仪,光学二维测量仪.的研发生产销售。东莞市大凡光学科技有限公司创立于 2018 年,公司总部坐落于... 点击进入详情页
本回答由东莞大凡提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式