Changes

Color Constants / Color Forms / Controls / Transparency VB6

983 bytes added, 19:33, 10 February 2008
/* All Possible Ways */
The following lines were added (+) and removed (-):
=== All Possible Ways ===1. In HEX, BLUE is first, Green, then Red, the reverse of RGB (actually BGR) is the default VB method  cmd(0).BackColor = &HFF&      ' Red  / &H0000FF&  cmd(1).BackColor = &HFF00&    ' Green / &H00FF00&  cmd(2).BackColor = &HFF0000  ' Blue  / &HFF0000&2. Decimal RGB value  cmd(0).BackColor = RGB(255, 0, 0)  cmd(1).BackColor = RGB(0, 255, 0)  cmd(2).BackColor = RGB(0, 0, 255)3. Using VB Color Constants  cmd(0).BackColor = vbRed  cmd(1).BackColor = vbGreen  cmd(2).BackColor = vbBlue=== Convert RGB Hex (like used in HTML) to VB Hex ===Code Sample: Public Function h2v(wHex As String) As Long  Dim strTmp As String  wHex = Trim("" & wHex)  If Len(wHex) = 7 Then    If Left(wHex, 1) = "#" Then wHex = Right(wHex, 6)  End If  If Len(wHex) = 6 Then    strTmp = "&H" & Right(wHex, 2) & Mid(wHex, 3, 2) & Left(wHex, 2) & "&"  Else    strTmp = "&H000000&"  End If  h2v = Val(strTmp)  Debug.Print h2v End Function
Bureaucrat, administrator
16,192
edits