Gruppe
Dialog
Problem
Die Hintergrundfarbe eines UserForm-Labels soll über ScrollBars unter Einsatz der RGB-Farben festgelegt werden.
StandardModule: Modul1
Sub DialogAufruf()
frmColors.Show
End Sub
ClassModule: frmColors
Private Sub cmdAbbrechen_Click()
End
End Sub
Private Sub ScrollBar1_Change()
Call SetColors
End Sub
Private Sub ScrollBar2_Change()
Call SetColors
End Sub
Private Sub ScrollBar3_Change()
Call SetColors
End Sub
Sub SetColors()
Dim strA As String, strB As String, strC As String, str As String
Dim varColor As Variant
str = "00"
strA = Hex(ScrollBar1.Value)
strA = strA & String(2 - Len(strA), "0")
strB = Hex(ScrollBar2.Value)
strB = strB & String(2 - Len(strB), "0")
strC = Hex(ScrollBar3.Value)
strC = strC & String(2 - Len(strC), "0")
varColor = str & strA & strB & strC
Label2.Caption = ScrollBar1.Value
Label3.Caption = ScrollBar2.Value
Label4.Caption = ScrollBar3.Value
Label1.BackColor = hex2dec(varColor)
End Sub
Private Sub UserForm_Initialize()
Call SetColors
End Sub