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

📄 usercontrol1.ctl

📁 多功能文档编辑器源代码,用VC++开发,适合编程人员参考使用。
💻 CTL
字号:
VERSION 5.00
Begin VB.UserControl XPButton 
   AutoRedraw      =   -1  'True
   ClientHeight    =   705
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   1530
   ScaleHeight     =   705
   ScaleWidth      =   1530
   Begin VB.Image im 
      Height          =   315
      Index           =   1
      Left            =   600
      Picture         =   "UserControl1.ctx":0000
      Top             =   2520
      Visible         =   0   'False
      Width           =   270
   End
   Begin VB.Image im 
      Height          =   315
      Index           =   3
      Left            =   1320
      Picture         =   "UserControl1.ctx":05BF
      Top             =   2520
      Visible         =   0   'False
      Width           =   270
   End
   Begin VB.Image im 
      Height          =   315
      Index           =   2
      Left            =   960
      Picture         =   "UserControl1.ctx":0BA4
      Top             =   2520
      Visible         =   0   'False
      Width           =   270
   End
End
Attribute VB_Name = "XPButton"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Const m_def_caption = "0"
Dim m_caption As String
Dim ifon As Boolean
Dim If2 As Boolean
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
'Event Declarations:
Event Click() 'MappingInfo=UserControl,UserControl,-1,Click
Attribute Click.VB_Description = "当用户在一个对象上按下并释放鼠标按钮时发生。"



Private Sub UserControl_Click()
If If2 = False Then Exit Sub
    RaiseEvent Click
End Sub

Public Property Get caption() As String
    caption = UserControl.Tag
End Property

Public Property Let caption(ByVal New_caption As String)
    UserControl.Tag = New_caption
    PrintB 1
    PropertyChanged "caption"
End Property


'为用户控件初始化属性
Private Sub UserControl_InitProperties()
    m_caption = m_def_caption
End Sub

'从存贮器中加载属性值
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
     UserControl.Tag = PropBag.ReadProperty("caption", m_def_caption)
     
End Sub

Private Sub UserControl_Show()
PrintB 1
End Sub

'将属性值写到存储器
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    Call PropBag.WriteProperty("caption", UserControl.Tag, m_def_caption)
    
End Sub

Public Sub UserControl_Resize()
PrintB 1
End Sub

Private Sub UserControl_Initialize()
PrintB 1
End Sub

Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   
    Dim MouseOver As Boolean
    '判断当前鼠标位置是否在控件上
    MouseOver = (0 <= X) And (X <= UserControl.Width) And (0 <= Y) And (Y <= UserControl.Height)
    If MouseOver Then
If ifon = False Then
PrintB 2

ifon = True
End If
SetCapture UserControl.hwnd
Else

PrintB 1

ifon = False
ReleaseCapture
End If
End Sub

Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
PrintB 3
If2 = True
Else
If2 = False
End If

End Sub

Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
ifon = False
PrintB 1

End Sub


Public Sub PrintB(z)
    
    brx = UserControl.Width - 45
    bry = UserControl.Height - 45
    bw = UserControl.Width - 90
    bh = UserControl.Height - 90
    
    UserControl.PaintPicture im(z).Picture, 0, 0, 45, 45, 0, 0, 45, 45
    UserControl.PaintPicture im(z).Picture, brx, 0, 45, 45, 225, 0, 45, 45
    UserControl.PaintPicture im(z).Picture, brx, bry, 45, 45, 225, 270, 45, 45
    UserControl.PaintPicture im(z).Picture, 0, bry, 45, 45, 0, 270, 45, 45
    UserControl.PaintPicture im(z).Picture, 45, 0, bw, 45, 45, 0, 180, 45
    UserControl.PaintPicture im(z).Picture, brx, 45, 45, bh, 225, 45, 45, 225
    UserControl.PaintPicture im(z).Picture, 0, 45, 45, bh, 0, 45, 45, 225
    UserControl.PaintPicture im(z).Picture, 45, bry, bw, 45, 45, 270, 180, 45
    UserControl.PaintPicture im(z).Picture, 45, 45, bw, bh, 45, 45, 180, 225

If UserControl.Tag <> "" Then
UserControl.CurrentX = (UserControl.Width - TextWidth(caption)) / 2
UserControl.CurrentY = (UserControl.Height - TextHeight(caption)) / 2
End If
UserControl.Print UserControl.Tag


End Sub

⌨️ 快捷键说明

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