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

📄 ctllabelscrollbar.ctl

📁 Visual Basic 6 大学教程的代码
💻 CTL
字号:
VERSION 5.00
Begin VB.UserControl LabelScrollbar 
   ClientHeight    =   270
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   3630
   ScaleHeight     =   270
   ScaleWidth      =   3630
   Begin VB.HScrollBar hsbScroll 
      Height          =   255
      Left            =   1080
      TabIndex        =   0
      Top             =   0
      Width           =   2535
   End
   Begin VB.Label lblDisplay 
      BorderStyle     =   1  'Fixed Single
      Height          =   255
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   855
   End
End
Attribute VB_Name = "LabelScrollbar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' Fig. 17.34
' Modified code generated by ActiveX Control Interface
' Wizard.
Option Explicit
'Event Declarations:
Event Change() 'MappingInfo=hsbScroll,hsbScroll,-1,Change
Attribute Change.VB_Description = "Occurs when the contents of a control have changed."

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=hsbScroll,hsbScroll,-1,LargeChange
Public Property Get LargeChange() As Integer
Attribute LargeChange.VB_Description = "Returns/sets amount of change to Value property in a scroll bar when user clicks the scroll bar area."
   LargeChange = hsbScroll.LargeChange
End Property

Public Property Let LargeChange(ByVal New_LargeChange As _
                                Integer)
   hsbScroll.LargeChange() = New_LargeChange
   PropertyChanged "LargeChange"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=hsbScroll,hsbScroll,-1,Min
Public Property Get Min() As Integer
Attribute Min.VB_Description = "Returns/sets a scroll bar position's maximum Value property setting."
   Min = hsbScroll.Min
End Property

Public Property Let Min(ByVal New_Min As Integer)
   hsbScroll.Min() = New_Min
   PropertyChanged "Min"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=hsbScroll,hsbScroll,-1,Max
Public Property Get Max() As Integer
Attribute Max.VB_Description = "Returns/sets a scroll bar position's maximum Value property setting."
   Max = hsbScroll.Max
End Property

Public Property Let Max(ByVal New_Max As Integer)
   hsbScroll.Max() = New_Max
   PropertyChanged "Max"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=hsbScroll,hsbScroll,-1,Value
Public Property Get Value() As Integer
Attribute Value.VB_Description = "Returns/sets the value of an object."
   Value = hsbScroll.Value
End Property

Public Property Let Value(ByVal New_Value As Integer)
   hsbScroll.Value() = New_Value
   PropertyChanged "Value"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=hsbScroll,hsbScroll,-1,SmallChange
Public Property Get SmallChange() As Integer
Attribute SmallChange.VB_Description = "Returns/sets amount of change to Value property in a scroll bar when user clicks a scroll arrow."
   SmallChange = hsbScroll.SmallChange
End Property

Public Property Let SmallChange(ByVal New_SmallChange As _
                                Integer)
   hsbScroll.SmallChange() = New_SmallChange
   PropertyChanged "SmallChange"
End Property

Private Sub hsbScroll_Change()
   RaiseEvent Change
   
   ' NOT generated by ActiveX Control Interface Wizard
   lblDisplay.Caption = hsbScroll.Value
End Sub

'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
   
   hsbScroll.LargeChange = PropBag.ReadProperty( _
                                              "LargeChange", 5)
   hsbScroll.Min = PropBag.ReadProperty("Min", 0)
   hsbScroll.Max = PropBag.ReadProperty("Max", 32767)
   hsbScroll.Value = PropBag.ReadProperty("Value", _
                                          (Min + Max) \ 2)
   hsbScroll.SmallChange = PropBag.ReadProperty( _
                                              "SmallChange", 1)
                                              
   ' NOT generated by ActiveX Control Interface Wizard
   lblDisplay.Caption = PropBag.ReadProperty("Caption", _
                                             hsbScroll.Value)
End Sub

'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

   Call PropBag.WriteProperty("LargeChange", _
                              hsbScroll.LargeChange, 5)
   Call PropBag.WriteProperty("Min", hsbScroll.Min, 0)
   Call PropBag.WriteProperty("Max", hsbScroll.Max, 32767)
   Call PropBag.WriteProperty("Value", hsbScroll.Value, _
                              (Min + Max) \ 2)
   Call PropBag.WriteProperty("SmallChange", _
                              hsbScroll.SmallChange, 1)
                              
   ' NOT generated by ActiveX Control Interface Wizard
   Call PropBag.WriteProperty("Caption", _
                              lblDisplay.Caption, _
                              (Min + Max) \ 2)
End Sub

' NOT generated by ActiveX Control Interface Wizard
Private Sub UserControl_InitProperties()
   With hsbScroll
      .Min = 0
      .Max = 32767
      .Value = (Min + Max) / 2
      .SmallChange = 1
      .LargeChange = 5
   End With
   
   lblDisplay.Caption = hsbScroll.Value
End Sub

' NOT generated by ActiveX Control Interface Wizard
Private Sub UserControl_Resize()

   With hsbScroll
      .Left = lblDisplay.Width + lblDisplay.Left
      .Width = ScaleWidth - hsbScroll.Left
      .Height = ScaleHeight
      .Top = (ScaleHeight - hsbScroll.Height) / 2
   End With
   
   With lblDisplay
      .Height = ScaleHeight
      .Top = (ScaleHeight - lblDisplay.Height) / 2
   End With
   
End Sub

⌨️ 快捷键说明

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