三九宝宝网宝宝绘画儿童画

电脑全屏显示VBA登录窗体图片设置

12月22日 编辑 39baobao.com

'1、模块里先建立一个API:

Public Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Public Const SM_CXSCREEN = 0

Public Const SM_CYSCREEN = 1

'2、在窗体下输入代码:

Private Sub CommandButton1_Click()

Application.Visible = False '将Excel文件隐藏

Dim x As Long, y As Long

x = GetSystemMetrics(SM_CXSCREEN)

y = GetSystemMetrics(SM_CYSCREEN)

'MsgBox "您的屏幕分辨率为:" & x & "*" & y

UserForm1.Width = x

UserForm1.Height = y

UserForm1.Top = 1

UserForm1.Left = 1

End Sub

推荐阅读
图文推荐