ritorna con variabili.html descrizione gestione variabili con VBA
esci con
vbasintassi1.htm


trasformazione di codice colore da RGB a esadecimale
con
algoritmo e con funzione Hex$
rgbesa.ppt

Private Sub CommandButton1_Click()
Dim r, g, b As Integer
Dim qr, qg, qb, rr, rg, rb As Integer
Dim sr, sg, sb As String
r = Val(TextBox1)
g = Val(TextBox2)
b = Val(TextBox3)
qr = Int(r / 16)
qg = Int(g / 16)
qb = Int(b / 16)
rr = (r Mod 16)
rg = (g Mod 16)
rb = (b Mod 16)
Rem calcolo esadecimale con funzione Hex$
sr = Hex$(r)
sg = Hex$(g)
sb = Hex$(b)
ListBox1.AddItem ("Hex$ " & sr & " " & sg & " " & sb)
ListBox1.AddItem ("prima doppietta")
ListBox1.AddItem (qr)
ListBox1.AddItem (rr)
ListBox1.AddItem ("seconda doppietta")
ListBox1.AddItem (qg)
ListBox1.AddItem (rg)
ListBox1.AddItem ("terza doppietta")
ListBox1.AddItem (qb)
ListBox1.AddItem (rb)
Image1.BackColor = RGB(r, g, b)

End Sub

Private Sub CommandButton3_Click()
Label1.Visible = True
End Sub

Private Sub CommandButton4_Click()
Label1.Visible = False
End Sub

Private Sub CommandButton5_Click()
Label4.Visible = True
End Sub

Private Sub CommandButton6_Click()
Label4.Visible = False
End Sub

Private Sub CommandButton7_Click()
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
End Sub

Private Sub CommandButton8_Click()
ListBox1.Clear
End Sub


Private Sub UserForm_Click()

End Sub