📄 scrollbar.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "RGB"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox bluetxt
Height = 270
Left = 3960
TabIndex = 5
Top = 2880
Width = 495
End
Begin VB.TextBox greentxt
Height = 270
Left = 3960
TabIndex = 4
Top = 2520
Width = 495
End
Begin VB.TextBox redtxt
Height = 270
Left = 3960
TabIndex = 3
Top = 2160
Width = 495
End
Begin VB.HScrollBar redscr
Height = 255
Left = 600
Max = 255
TabIndex = 2
Top = 2160
Width = 3255
End
Begin VB.HScrollBar bluescr
Height = 255
Left = 600
Max = 255
TabIndex = 1
Top = 2880
Width = 3255
End
Begin VB.HScrollBar greenscr
Height = 255
Left = 600
Max = 255
TabIndex = 0
Top = 2520
Width = 3255
End
Begin VB.Label Label1
Height = 1935
Left = 120
TabIndex = 9
Top = 0
Width = 4455
End
Begin VB.Label bluelab
Caption = "BLUE"
Height = 255
Left = 120
TabIndex = 8
Top = 2880
Width = 495
End
Begin VB.Label greenlab
Caption = "GREEN"
Height = 255
Left = 120
TabIndex = 7
Top = 2520
Width = 495
End
Begin VB.Label redlab
Caption = "RED"
Height = 255
Left = 120
TabIndex = 6
Top = 2160
Width = 495
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
redtxt.Text = CStr(redscr.Value)
greentxt.Text = CStr(greenscr.Value)
bluetxt.Text = CStr(bluescr.Value)
Call dis_clr
End Sub
' 当滚动条change事件发生时,在相应的文本框中显示它的值并显示颜色
Private Sub redscr_Change()
redtxt.Text = CStr(redscr.Value)
Call dis_clr
End Sub
Private Sub greenscr_Change()
greentxt.Text = CStr(greenscr.Value)
Call dis_clr
End Sub
Private Sub bluescr_Change()
bluetxt.Text = CStr(bluescr.Value)
Call dis_clr
End Sub
' 当文本框的值改变时,设置滚动条的位置并显示颜色
Private Sub redtxt_Change()
redscr.Value = CInt(redtxt.Text)
Call dis_clr
End Sub
Private Sub greentxt_Change()
greenscr.Value = CInt(greentxt.Text)
Call dis_clr
End Sub
Private Sub bluetxt_Change()
bluescr.Value = CInt(bluetxt.Text)
Call dis_clr
End Sub
' 用来显示颜色于文本框中
Sub dis_clr()
'按照RGB方式设置文本的背景色
Label1.BackColor = RGB(redscr.Value, greenscr.Value, bluescr.Value)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -