当前位置:首页教育技巧WPS技巧wps文档

wps vba窗体,Excel vba 实现窗体全屏效果代码

2025-01-12 09:38:44


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运行,全屏效果还是不错的。马上收藏,备用。

相关信息


电脑版

【免责声明】本站信息来自网友投稿及网络整理,内容仅供参考,如果有错误请反馈给我们及时更正,对文中内容的真实性和完整性本站不提供任何保证,不承但任何责任。
版权所有:学窍知识网 Copyright © 2011-2025 www.at317.com All Rights Reserved .