⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messagebutton.ctl

📁 个人VB学习源码精选,自己学习时的一些编程小程序,希望对大家有帮助
💻 CTL
字号:
VERSION 5.00
Begin VB.UserControl MessageButton 
   ClientHeight    =   495
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   1440
   ScaleHeight     =   495
   ScaleWidth      =   1440
   Begin VB.CommandButton cmdAction 
      Caption         =   "Command1"
      Height          =   465
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   1410
   End
End
Attribute VB_Name = "MessageButton"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'缺省属性值:
Const m_def_MessageTitle = "Message Button"
Const m_def_MessageText = "You Clicked me!"
'属性变量:
Dim m_MessageTitle As String
Dim m_MessageText As String
Public Event Click()    '定义事件


'注意!不要删除或修改下列被注释的行!
'MappingInfo=cmdAction,cmdAction,-1,Caption
Public Property Get ButtonCaption() As String
Attribute ButtonCaption.VB_Description = "返回/设置对象的标题栏中或图标下面的文本。"
    ButtonCaption = cmdAction.Caption
End Property

Public Property Let ButtonCaption(ByVal New_ButtonCaption As String)
    cmdAction.Caption() = New_ButtonCaption
    PropertyChanged "ButtonCaption"
End Property

'注意!不要删除或修改下列被注释的行!
'MemberInfo=13,0,0,Message Button
Public Property Get MessageTitle() As String
    MessageTitle = m_MessageTitle
End Property

Public Property Let MessageTitle(ByVal New_MessageTitle As String)
    m_MessageTitle = New_MessageTitle
    PropertyChanged "MessageTitle"
End Property

'注意!不要删除或修改下列被注释的行!
'MemberInfo=13,0,0,You Clicked me!
Public Property Get MessageText() As String
    MessageText = m_MessageText
End Property

Public Property Let MessageText(ByVal New_MessageText As String)
    m_MessageText = New_MessageText
    PropertyChanged "MessageText"
End Property

Private Sub cmdAction_Click()
    ShowMessage
End Sub

'为用户控件初始化属性
Private Sub UserControl_InitProperties()
    m_MessageTitle = m_def_MessageTitle
    m_MessageText = m_def_MessageText
End Sub

'从存贮器中加载属性值
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

    cmdAction.Caption = PropBag.ReadProperty("ButtonCaption", "Command1")
    m_MessageTitle = PropBag.ReadProperty("MessageTitle", m_def_MessageTitle)
    m_MessageText = PropBag.ReadProperty("MessageText", m_def_MessageText)
End Sub

'将属性值写到存储器
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

    Call PropBag.WriteProperty("ButtonCaption", cmdAction.Caption, "Command1")
    Call PropBag.WriteProperty("MessageTitle", m_MessageTitle, m_def_MessageTitle)
    Call PropBag.WriteProperty("MessageText", m_MessageText, m_def_MessageText)
End Sub

Public Sub ForceClick()
    ShowMessage
    RaiseEvent Click    '触发事件
End Sub
Private Sub ShowMessage()
    MsgBox m_MessageText, vbExclamation, m_MessageTitle
End Sub

⌨️ 快捷键说明

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