wps vba窗体,Excel vba 实现窗体全屏效果代码
Excel vba 窗体编辑中,有时候需要做全屏幕效果,这是个很好的想法,我们用几行简单代码即可实现。
全屏效果
全屏代码
- 下面代码放到VBE编辑器通用申明里。
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Const SM_CXSCREEN As Long = 0
Const SM_CYSCREEN As Long = 1
- 在UserForm_Initialize过程事件中如下代码:
With Me
.Height = GetSystemMetrics(SM_CYSCREEN) * 0.75
.Width = GetSystemMetrics(SM_CXSCREEN) * 0.75
.Left = 0
.Top = 0
End With
- 下面是立体文字代码,也写到UserForm_Initialize过程事件中。
With Me.Label1
.Top = 100
.Left = 0
.Height = .Parent.Height
.Width = .Parent.Width
.Font.Size = 200
.Font.Name = "微软雅黑"
.Caption = "全屏效果"
.ForeColor = RGB(201, 122, 21)
.TextAlign = fmTextAlignCenter
.BackStyle = fmBackStyleTransparents
End With
With Me.Label2
.Top = 102
.Left = 15
.Height = .Parent.Height
.Width = .Parent.Width
.Font.Size = 200
.Font.Name = "微软雅黑"
.Caption = "全屏效果"
.ForeColor = RGB(211, 152, 211)
.TextAlign = fmTextAlignCenter
.BackStyle = fmBackStyleTransparent
End With
With Me.Label3
.Top = 0
.Left = 0
.Height = 50
.Width = 100
.Font.Size = 20
.Font.Name = "微软雅黑"
.Caption = "头条.江觅"
.ForeColor = RGB(211, 212, 211)
.TextAlign = fmTextAlignCenter
.BackStyle = fmBackStyleTransparent
End With
保存按F5运行,全屏效果还是不错的。马上收藏,备用。