www.pudn.com > QQ2009.rar > cKeybCmd.ctl, change:2009-11-15,size:8377b


VERSION 5.00 
Begin VB.UserControl cKeybCmd  
   AutoRedraw      =   -1  'True 
   CanGetFocus     =   0   'False 
   ClientHeight    =   3495 
   ClientLeft      =   0 
   ClientTop       =   0 
   ClientWidth     =   4800 
   BeginProperty Font  
      Name            =   "Verdana" 
      Size            =   8.25 
      Charset         =   0 
      Weight          =   400 
      Underline       =   0   'False 
      Italic          =   0   'False 
      Strikethrough   =   0   'False 
   EndProperty 
   ScaleHeight     =   233 
   ScaleMode       =   3  'Pixel 
   ScaleWidth      =   320 
   ToolboxBitmap   =   "cKeybCmd.ctx":0000 
   Begin VB.Image imgDown  
      Height          =   360 
      Index           =   2 
      Left            =   1680 
      Picture         =   "cKeybCmd.ctx":0312 
      Top             =   3000 
      Visible         =   0   'False 
      Width           =   30 
   End 
   Begin VB.Image imgDown  
      Height          =   360 
      Index           =   1 
      Left            =   1560 
      Picture         =   "cKeybCmd.ctx":0414 
      Top             =   3000 
      Visible         =   0   'False 
      Width           =   15 
   End 
   Begin VB.Image imgDown  
      Height          =   360 
      Index           =   0 
      Left            =   1440 
      Picture         =   "cKeybCmd.ctx":04B6 
      Top             =   3000 
      Visible         =   0   'False 
      Width           =   30 
   End 
   Begin VB.Image imgOver  
      Height          =   360 
      Index           =   2 
      Left            =   1680 
      Picture         =   "cKeybCmd.ctx":05B8 
      Top             =   2400 
      Visible         =   0   'False 
      Width           =   30 
   End 
   Begin VB.Image imgOver  
      Height          =   360 
      Index           =   1 
      Left            =   1560 
      Picture         =   "cKeybCmd.ctx":06BA 
      Top             =   2400 
      Visible         =   0   'False 
      Width           =   15 
   End 
   Begin VB.Image imgOver  
      Height          =   360 
      Index           =   0 
      Left            =   1440 
      Picture         =   "cKeybCmd.ctx":075C 
      Top             =   2400 
      Visible         =   0   'False 
      Width           =   30 
   End 
   Begin VB.Image imgNormal  
      Height          =   360 
      Index           =   2 
      Left            =   1680 
      Picture         =   "cKeybCmd.ctx":085E 
      Top             =   1800 
      Visible         =   0   'False 
      Width           =   30 
   End 
   Begin VB.Image imgNormal  
      Height          =   360 
      Index           =   1 
      Left            =   1560 
      Picture         =   "cKeybCmd.ctx":0960 
      Top             =   1800 
      Visible         =   0   'False 
      Width           =   15 
   End 
   Begin VB.Image imgNormal  
      Height          =   360 
      Index           =   0 
      Left            =   1440 
      Picture         =   "cKeybCmd.ctx":0A02 
      Top             =   1800 
      Visible         =   0   'False 
      Width           =   30 
   End 
End 
Attribute VB_Name = "cKeybCmd" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = True 
Attribute VB_PredeclaredId = False 
Attribute VB_Exposed = False 
 
Option Explicit 
 
Dim btnState As Integer 
 
Const m_def_ButtonDown = False 
Const m_def_ButtonType = 0 
Const m_def_MainCaption = 0 
Const m_def_Caption1 = "" 
Const m_def_Caption2 = "" 
 
Dim m_ButtonDown As Boolean 
Dim m_ButtonType As Integer 
Dim m_MainCaption As Integer 
Dim m_Caption1 As String 
Dim m_Caption2 As String 
 
Event Click() 
 
Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) 
    If Button = 1 Then 
        btnState = 2 
        Redraw 
    End If 
End Sub 
 
Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) 
    Dim oldState As Integer 
    oldState = btnState 
     
    If x < 0 Or y < 0 Or x > UserControl.ScaleWidth Or y > UserControl.ScaleHeight Then 
        If m_ButtonDown Then btnState = 2 Else btnState = 0 
         
        ReleaseCapture 
    Else 
        If m_ButtonDown Then 
            btnState = 2 
        Else 
            If Button = 1 Then btnState = 2 Else btnState = 1 
        End If 
         
        SetCapture UserControl.hWnd 
    End If 
     
    If oldState <> btnState Then Redraw 
End Sub 
 
Private Sub UserControl_Resize() 
    UserControl.Height = 24 * tY 
     
    Redraw 
End Sub 
 
Private Sub Redraw() 
    Dim strW As Single, strH As Single 
     
    UserControl.Cls 
     
    If ButtonDown Or btnState = 2 Then 
        PaintPicture imgDown(0).Picture, 0, 0 
        PaintPicture imgDown(1).Picture, 2, 0, UserControl.ScaleWidth - 4 
        PaintPicture imgDown(2).Picture, UserControl.ScaleWidth - 2, 0 
    ElseIf btnState = 0 Then 
        PaintPicture imgNormal(0).Picture, 0, 0 
        PaintPicture imgNormal(1).Picture, 2, 0, UserControl.ScaleWidth - 4 
        PaintPicture imgNormal(2).Picture, UserControl.ScaleWidth - 2, 0 
    ElseIf btnState = 1 Then 
        PaintPicture imgOver(0).Picture, 0, 0 
        PaintPicture imgOver(1).Picture, 2, 0, UserControl.ScaleWidth - 4 
        PaintPicture imgOver(2).Picture, UserControl.ScaleWidth - 2, 0 
    End If 
     
    If m_ButtonType = 0 Then 
        strW = TextWidth(m_Caption1) 
        CurrentX = ScaleWidth / 2 - strW / 2 
        CurrentY = 5 
         
        ForeColor = &H0 
        Print m_Caption1 
    Else 
        CurrentX = 3 
        CurrentY = 5 
         
        If m_MainCaption = 0 Then ForeColor = &H0 Else ForeColor = &H888888 
        Print m_Caption1 
         
        CurrentX = 13 
        CurrentY = 1 
         
        If m_MainCaption = 0 Then ForeColor = &H888888 Else ForeColor = &H0 
        Print m_Caption2 
    End If 
End Sub 
 
Private Sub UserControl_Click() 
    RaiseEvent Click 
End Sub 
 
Public Property Get ButtonDown() As Boolean 
    ButtonDown = m_ButtonDown 
End Property 
 
Public Property Let ButtonDown(ByVal New_ButtonDown As Boolean) 
    m_ButtonDown = New_ButtonDown 
    Redraw 
     
    PropertyChanged "ButtonDown" 
End Property 
 
Public Property Get ButtonType() As Integer 
    ButtonType = m_ButtonType 
End Property 
 
Public Property Let ButtonType(ByVal New_ButtonType As Integer) 
    m_ButtonType = New_ButtonType 
    Redraw 
     
    PropertyChanged "ButtonType" 
End Property 
 
Public Property Get MainCaption() As Integer 
    MainCaption = m_MainCaption 
End Property 
 
Public Property Let MainCaption(ByVal New_MainCaption As Integer) 
    m_MainCaption = New_MainCaption 
    Redraw 
     
    PropertyChanged "MainCaption" 
End Property 
 
Public Property Get Caption1() As String 
    Caption1 = m_Caption1 
End Property 
 
Public Property Let Caption1(ByVal New_Caption1 As String) 
    m_Caption1 = New_Caption1 
    Redraw 
     
    PropertyChanged "Caption1" 
End Property 
 
Public Property Get Caption2() As String 
    Caption2 = m_Caption2 
End Property 
 
Public Property Let Caption2(ByVal New_Caption2 As String) 
    m_Caption2 = New_Caption2 
    Redraw 
     
    PropertyChanged "Caption2" 
End Property 
 
Private Sub UserControl_InitProperties() 
    m_ButtonDown = m_def_ButtonDown 
    m_ButtonType = m_def_ButtonType 
    m_MainCaption = m_def_MainCaption 
    m_Caption1 = m_def_Caption1 
    m_Caption2 = m_def_Caption2 
End Sub 
 
Private Sub UserControl_ReadProperties(PropBag As PropertyBag) 
    m_ButtonDown = PropBag.ReadProperty("ButtonDown", m_def_ButtonDown) 
    m_ButtonType = PropBag.ReadProperty("ButtonType", m_def_ButtonType) 
    m_MainCaption = PropBag.ReadProperty("MainCaption", m_def_MainCaption) 
    m_Caption1 = PropBag.ReadProperty("Caption1", m_def_Caption1) 
    m_Caption2 = PropBag.ReadProperty("Caption2", m_def_Caption2) 
     
    Redraw 
End Sub 
 
Private Sub UserControl_WriteProperties(PropBag As PropertyBag) 
    Call PropBag.WriteProperty("ButtonDown", m_ButtonDown, m_def_ButtonDown) 
    Call PropBag.WriteProperty("ButtonType", m_ButtonType, m_def_ButtonType) 
    Call PropBag.WriteProperty("MainCaption", m_MainCaption, m_def_MainCaption) 
    Call PropBag.WriteProperty("Caption1", m_Caption1, m_def_Caption1) 
    Call PropBag.WriteProperty("Caption2", m_Caption2, m_def_Caption2) 
End Sub