form1.frm

来自「很好的教程原代码!」· FRM 代码 · 共 50 行

FRM
50
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   1680
      TabIndex        =   0
      Top             =   1080
      Width           =   1095
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'  SetWindowLong 函数声明
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long _
) As Long
' 函数使用的常量声明
' WS_EX_TRANSPARENT告诉SetWindowLong函数使窗体透明
Const WS_EX_TRANSPARENT = &H20&
Const GWL_EXSTYLE = (-20)


'变窗体为透明的函数
'在需要的地方调用该函数
Public Sub MakeTransparent()
        Dim Retval As Long
    '使窗体透明
    Retval = SetWindowLong(Me.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)
End Sub

Private Sub Command1_Click()
MakeTransparent
Form1.Refresh
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?