目前的几个其它回答都不行的,那是自欺欺人的办法,跟网游的全屏模式完全不一样。而且任务栏无法隐藏,下面的办法可以隐藏任务栏,改变屏幕分辨率并且复原。我用VB写游戏的时候用到的。
把下面这一段放在新建模块里面,有4个参数需要看看,在最后面
Public lngwidth As Long '屏幕横向宽度
Public lngheight As Long '屏幕纵向宽度
Public intcolor As Integer '屏幕颜色质量
Public LngFrequency As Long '屏幕刷新率
Public int_currentX As Long '取得当前屏幕宽度
Public int_currenty As Long '取得当前屏幕高度
Public int_frequency As Long '取得当前屏幕刷新率
Option Explicit
'定义更改设置屏幕函数
Public Declare Function ChangeDisplaySettings Lib "user32.dll" Alias "ChangeDisplaySettingsA" _
(ByRef lpDevMode As DEVMODE, ByVal dwflags As Long) As Long
Public Declare Function EnumDisplaySettings Lib "user32.dll" Alias "EnumDisplaySettingsA" (ByVal _
lpszDeviceName As String, ByVal iModeNum As Long, ByRef lpDevMode As DEVMODE) As Long
'定义打开链接函数
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const DM_PELSHEIGHT As Long = &H100000
Const DM_PELSWIDTH As Long = &H80000
Const DM_BITSPERPEL As Long = &H40000
Const DM_DISPLAYFREQUENCY As Long = &H400000
Const CCHDEVICENAME As Long = 32
Const CCHFORMNAME As Long = 32
Private Type DEVMODE
dmDeviceName As String * CCHDEVICENAME
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 * CCHFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
'-------------------------------------------------------------------------------------------
' LngWidth //屏幕的宽(单位象素)
' LngHeight //屏幕的高(单位象素)
' IntColor //多少位颜色(e.g 16 or 32)
' LngFrequency //屏幕的刷新频率
'
'声明:
'------------------------------------------------------------------------------------------
Public Function SetDisplaymode(lngwidth As Long, lngheight As Long, intcolor As Integer, _
LngFrequency As Long) As Long
Dim NewDevmode As DEVMODE
Dim lngP As Long
'obtains information
EnumDisplaySettings 0&, 0&, NewDevmode
With NewDevmode
.dmFields = DM_PELSHEIGHT Or DM_PELSWIDTH Or DM_BITSPERPEL Or DM_DISPLAYFREQUENCY
.dmPelsWidth = lngwidth
.dmPelsHeight = lngheight
.dmBitsPerPel = intcolor
.dmDisplayFrequency = LngFrequency
End With
SetDisplaymode = ChangeDisplaySettings(NewDevmode, 0)
End Function
Public Sub loadscreen()
Const CCDEVICENAME = 32
Const CCFORMNAME = 32
Const ENUM_CURRENT_SETTINGS = -1
Call closerwl
Call SetDisplaymode(800, 600, 32, LngFrequency)'这里是800*600是分辨率32是颜色深度 后面的是刷新率
End Sub
Public Sub unloadscreen()
Call openrwl
Call SetDisplaymode(int_currentX, int_currenty, 32, LngFrequency)
End Sub
然后程序在任何地方要用的时候直接
call loadscreen '全屏模式
call unloadscreen '退出全屏模式
哈哈 给分 ps你是不是在做游戏? 我也是啊~
温馨提示:内容为网友见解,仅供参考
vb如何使一个窗口全屏显示?
用一个api即可实现窗口全屏显示,如下:Const GWL_STYLE = (-16)Dim trect As RECT, tmpstyle As Long trect.left=0 trect.top=0 trect.right=screen.width\/15-1 trect.bottom=screen.height\/15-1 tmpstyle = GetWindowLong(Form1.hwnd, GWL_STYLE)Call AdjustWindowRect(trect, tmpstyle, 0)Fo...
在VB中如何实现全屏
方法和代码如下:SPR4Y回答:\\'在“工程(Project)”里点选“设定引用项目”,来引用DirectX物件。\\'接著将“DirectX 7 for Visual Basic Type Library”的那一行打勾,就可以开始使用DirectX了。\\'在通用部分定义如下:\\'Dim objDX As New DirectX7 \\'Dim objDD As DirectDraw7 \\'Dim objDDPrim...
vb6.0中怎样让窗体全屏显示?
1、首先在开发工具中打开VBA编辑器。2、在单元格区域当中输入一些内容作为例子。3、在VBA编辑器中插入模块。4、在模块当中输入如下代码,然后运行Private Sub UserForm_Initialize() Me.Height=Application.Height '窗体高度等于Excel程序的高度 Me.Width=Application.Width '窗体宽度等于Excel程序的宽度End ...
VB中让窗体全屏显示的代码是什么啊
1.打开Microsoft Visual Studio 2008\/2010或者Visual basic应用软件;2.新建一个windows窗体应用程序;3.选中窗体,在右下角窗体属性中找到windowstate和formborderstyle两项。分别将其属性更改为Maximized和None(windowstate:Maximized\/formborderstyle:None);4.按F5运行看看是不是已经全屏运行了。
VB程序如何实现全屏模式
'先把form 的 BorderStyle 设置为 0 ,由于为只读,程序无法修改,在运行之前你先设置一下。Private Sub Command1_Click()'Unload Me '直接退出 Me.WindowState = vbNormal '恢复正常 End Sub Private Sub Form_Load()Me.WindowState = vbMaximized '启动时最大化 End Sub ...
在VB中怎么实现整个界面的全屏操作呢?(窗体和控件都要按比例变化)_百 ...
FormOldLeft Command1.Caption = "全屏"End If End Sub Private Sub Command2_Click()End End Sub Private Sub Form_Load()Call ResizeInit(Me) '在装入时必须加入 Command1.Caption = "全屏"End Sub Private Sub Form_Resize()Call ResizeForm(Me) '控件随之改变 End Sub ...
vb6.0中怎样让窗体全屏显示?
1、首先在开发工具中打开VBA编辑器。2、在单元格区域当中输入一些内容作为例子。3、在VBA编辑器中插入模块。4、在模块当中输入如下代码,然后运行Private Sub UserForm_Initialize() Me.Height=Application.Height '窗体高度等于Excel程序的高度 Me.Width=Application.Width '窗体宽度等于Excel程序的宽度End ...
vb如何用代码实现全屏与非全屏的转换
= "全屏"Form1.WindowState = 0 End If End Sub 然后在窗体的resize事件中,把flash的高和宽都改一下 如果flash控件的名称为fla 那么在resize中加入如下代码 with fla .left=0 .top=0 .height=me.height .width=me.width end with 这样就可以实现在窗口最大化的时候,flash也全屏了。
使用vb做一个全屏的窗口
目前的几个其它回答都不行的,那是自欺欺人的办法,跟网游的全屏模式完全不一样。而且任务栏无法隐藏,下面的办法可以隐藏任务栏,改变屏幕分辨率并且复原。我用VB写游戏的时候用到的。把下面这一段放在新建模块里面,有4个参数需要看看,在最后面 Public lngwidth As Long '屏幕横向宽度 Public lng...
VB编程 求一个全屏窗口可以上下移动不可以左右移动 向上移动后 自动关 ...
用timer控件就可以完成 Dim x, y As Double Dim a, b As Double Private Sub Form_Load()a = Form1.Left b = Form1.Top Timer1.Enabled = True Timer1.Interval = 10 End Sub Private Sub Timer1_Timer()x = Form1.Left y = Form1.Top If a <> x Then MsgBox "窗口不允许左右...