求助!~!如何....

Macauboy 2004-05-07 08:46:54
请问各位前辈如何将做好的vb程序由800*600转变成1024*768的分辨率??
急求!~!
谢谢!~!~!
...全文
12 3 点赞 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Macauboy 2004-05-07
谢谢了!~!~
  • 打赏
  • 举报
回复
chinaren502 2004-05-07
Option Explicit
Public Declare Function EnumDisplaySettings Lib "user32" Alias _
"EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, _
ByVal iModeNum As Long, lpDevMode As Any) As Long

Public Declare Function ChangeDisplaySettings Lib "user32" Alias _
"ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwflags As Long) As Long
Public Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, _
ByVal dwReserved As Long) As Long

Private Const EWX_REBOOT = 2 ' 重开机
Private Const CCDEVICENAME = 32
Private Const CCFORMNAME = 32
Private Const DM_PELSWIDTH = &H80000
Private Const DM_PELSHEIGHT = &H100000

Private Const DISP_CHANGE_SUCCESSFUL = 0
Private Const DISP_CHANGE_RESTART = 1
Private Const CDS_UPDATEREGISTRY = 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
Private DevM As DEVMODE


Public Sub SetScreenOk()


Dim i As Long
Dim b As Long
Dim ans As Long
Dim a As Long
Dim x, y As Long
x = Screen.Width \ Screen.TwipsPerPixelX
y = Screen.Height \ Screen.TwipsPerPixelY



a = EnumDisplaySettings(0, 0, DevM) 'Initial Setting

DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
DevM.dmPelsWidth = 1024 '设定成想要的分辨率
DevM.dmPelsHeight = 768
b = ChangeDisplaySettings(DevM, 0) 'Changed Only this time


End Sub
  • 打赏
  • 举报
回复
daisy8675 2004-05-07
vb對此支持不好,可以用在resize事情中進行改變

或者你在ini文件中先記錄初始數值,分辨率可以用api先判斷
  • 打赏
  • 举报
回复
相关推荐
发帖
VB基础类
加入

7545

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2004-05-07 08:46
社区公告
暂无公告