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

📄 yfoption.ctl

📁 这是好东西南的,大家快来看看呀,对于有C语言编程的的有好大的帮助
💻 CTL
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.UserControl YFOption 
   BackColor       =   &H00FCBD6C&
   ClientHeight    =   2940
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   4680
   LockControls    =   -1  'True
   ScaleHeight     =   2940
   ScaleWidth      =   4680
   ToolboxBitmap   =   "YFOption.ctx":0000
   Begin MSComctlLib.ImageList ImageList2 
      Left            =   180
      Top             =   540
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   10
      ImageHeight     =   10
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   4
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "YFOption.ctx":0312
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "YFOption.ctx":1769
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "YFOption.ctx":2BC3
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "YFOption.ctx":2C39
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Image imgDX 
      Height          =   150
      Index           =   7
      Left            =   0
      Picture         =   "YFOption.ctx":2CB2
      Top             =   0
      Width           =   150
   End
   Begin VB.Image imgDX 
      Height          =   150
      Index           =   6
      Left            =   0
      Picture         =   "YFOption.ctx":2D18
      Top             =   0
      Width           =   150
   End
   Begin VB.Image imgDX 
      Height          =   150
      Index           =   5
      Left            =   0
      Picture         =   "YFOption.ctx":2D7E
      Top             =   0
      Width           =   150
   End
   Begin VB.Image imgDX 
      Height          =   150
      Index           =   4
      Left            =   0
      Picture         =   "YFOption.ctx":2DE4
      Top             =   0
      Width           =   150
   End
   Begin VB.Image imgDX 
      Height          =   150
      Index           =   3
      Left            =   0
      Picture         =   "YFOption.ctx":2E4A
      Top             =   0
      Width           =   150
   End
   Begin VB.Label labDX 
      BackStyle       =   0  'Transparent
      Caption         =   " 常数"
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   7
      Left            =   0
      TabIndex        =   7
      Top             =   0
      Width           =   450
   End
   Begin VB.Label labDX 
      BackStyle       =   0  'Transparent
      Caption         =   " 常数"
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   6
      Left            =   0
      TabIndex        =   6
      Top             =   0
      Width           =   450
   End
   Begin VB.Label labDX 
      BackStyle       =   0  'Transparent
      Caption         =   " 常数"
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   5
      Left            =   0
      TabIndex        =   5
      Top             =   0
      Width           =   450
   End
   Begin VB.Label labDX 
      BackStyle       =   0  'Transparent
      Caption         =   " 常数"
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   4
      Left            =   0
      TabIndex        =   4
      Top             =   0
      Width           =   450
   End
   Begin VB.Label labDX 
      BackStyle       =   0  'Transparent
      Caption         =   " 常数"
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   3
      Left            =   0
      TabIndex        =   3
      Top             =   0
      Width           =   450
   End
   Begin VB.Image imgDX 
      Height          =   150
      Index           =   0
      Left            =   0
      Picture         =   "YFOption.ctx":2EB0
      Top             =   0
      Width           =   150
   End
   Begin VB.Image imgDX 
      Height          =   150
      Index           =   1
      Left            =   582
      Picture         =   "YFOption.ctx":2F19
      Top             =   0
      Width           =   150
   End
   Begin VB.Image imgDX 
      Height          =   150
      Index           =   2
      Left            =   1165
      Picture         =   "YFOption.ctx":2F7F
      Top             =   0
      Width           =   150
   End
   Begin VB.Label labDX 
      BackStyle       =   0  'Transparent
      Caption         =   " 声明"
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   0
      Left            =   90
      TabIndex        =   2
      Top             =   0
      Width           =   450
   End
   Begin VB.Label labDX 
      BackStyle       =   0  'Transparent
      Caption         =   " 类型"
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   1
      Left            =   670
      TabIndex        =   1
      Top             =   0
      Width           =   450
   End
   Begin VB.Label labDX 
      BackStyle       =   0  'Transparent
      Caption         =   " 常数"
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   2
      Left            =   1255
      TabIndex        =   0
      Top             =   0
      Width           =   450
   End
End
Attribute VB_Name = "YFOption"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim m_Num As Integer
Dim m_Flag As Boolean
Dim mLen As Integer
Dim DX(7) As Boolean
Event Click(no As Integer)


Private Sub UserControl_Initialize()
   Dim i As Integer
   m_Num = 3
   For i = 0 To 7
    labDX(i).Caption = "Option" + Format(i, "0")
   Next i
  For i = 3 To 7
    labDX(i).Visible = False
    imgDX(i).Visible = False
  Next i
End Sub

Private Sub UserControl_Resize()
  Dim i As Integer
  If m_Flag = False Then
      mLen = UserControl.Width / m_Num
      UserControl.Height = 180
     For i = 0 To m_Num - 1
       imgDX(i).Left = mLen * i
       labDX(i).Left = imgDX(i).Left + imgDX(i).Width + 10
       labDX(i).Width = mLen - imgDX(i).Width + 10
     Next i
  Else
      mLen = UserControl.Height / m_Num
     For i = 0 To m_Num - 1
       imgDX(i).Left = 0
       labDX(i).Left = imgDX(i).Left + imgDX(i).Width + 10
       labDX(i).Width = UserControl.Width - imgDX(i).Width + 10
       imgDX(i).Top = mLen * i
       labDX(i).Top = imgDX(i).Top
     Next i
    
  
  End If
End Sub

Public Sub SetText(txtText() As String)
  Dim i As Integer
  
  For i = 0 To 7
    labDX(i).Visible = False
    imgDX(i).Visible = False
  Next i
  For i = 0 To m_Num - 1
    labDX(i).Caption = txtText(i)
    labDX(i).Visible = True
    imgDX(i).Visible = True
  Next i
End Sub

Private Sub labDX_Click(Index As Integer)
 imgDX_Click (Index)
End Sub

'选择查询类型
Private Sub imgDX_Click(Index As Integer)
   Dim i As Integer
   For i = 0 To m_Num - 1
     imgDX(i).Picture = ImageList2.ListImages(3).Picture
     DX(i) = False
   Next i
   DX(Index) = True
   imgDX(Index).Picture = ImageList2.ListImages(4).Picture
   RaiseEvent Click(Index)
End Sub

'从PropertyBag中读属性值
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
   '--------------------------------------------------------------
   '取数据
        m_Num = PropBag.ReadProperty("Num", 3)
        m_Flag = PropBag.ReadProperty("Flag", False)
        Dim i As Integer
        For i = 0 To 7
          labDX(i).Visible = False
          imgDX(i).Visible = False
        Next i
        For i = 0 To m_Num - 1
          labDX(i).Visible = True
          imgDX(i).Visible = True
        Next i

        UserControl_Resize
End Sub
'把属性值保存在PropertyBag中
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
   '----------------------------------------------------------------
   '存属性值
   PropBag.WriteProperty "Num", m_Num, 3
   PropBag.WriteProperty "Flag", m_Flag, False
End Sub


Public Property Get Num() As Integer
  Num = m_Num
End Property

Public Property Let Num(ByVal vNewValue As Integer)
  Dim i As Integer
  If vNewValue > 8 Then
    MsgBox "个数<=8!"
  Else
    m_Num = vNewValue
        
    For i = 0 To 7
      labDX(i).Visible = False
      imgDX(i).Visible = False
    Next i
    For i = 0 To m_Num - 1
      labDX(i).Visible = True
      imgDX(i).Visible = True
    Next i

    UserControl_Resize
    PropertyChanged "Num"
  End If
End Property

Public Property Get Flag() As Boolean
  Flag = m_Flag
End Property

Public Property Let Flag(ByVal vNewValue As Boolean)
   m_Flag = vNewValue
    UserControl_Resize
   PropertyChanged "Flag"
End Property

⌨️ 快捷键说明

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