VTW Color Picker

Script

Dim PosX, PosY
Dim colorPicker

Sub ImageMouseDown(Sender, Button, Shift, X, Y)
    PosX = X
    PosY = Y
End sub

Sub ImageOnClick(Sender)
    colorPicker = Sender.Canvas.Pixels(PosX, PosY)
    txtCCColor.Text = ConvertToCColor(colorPicker)
    txtRGBColor.Text = ConvertToRgb(colorPicker)
    txtRGBColor.Color = colorPicker
    txtCCColor.Color = colorPicker
End sub

Function ConvertToRgb(color)
    Dim red, green, blue, temp
    temp = color
    red = temp Mod &H100
    temp = temp \ &H100
    green = temp Mod &H100
    temp = temp \ &H100
    blue = temp Mod &H100
    ConvertToRgb = red & "," & green & "," & blue
End Function

Function ConvertToCColor(color)
    Dim red, green, blue, temp
    temp = color
    red = temp Mod &H100
    temp = temp \ &H100
    green = temp Mod &H100
    temp = temp \ &H100
    blue = temp Mod &H100
    ConvertToCColor = ConvertValue(red/255) & " " & ConvertValue(green/255) & " " & ConvertValue(blue/255)
End Function

Function ConvertValue(data)
    If data = Empty Then
       ConvertValue = "0"
    Else
       data = Replace(data, ".", ",")
       If IsNumeric(data) = true Then
          ConvertValue = FormatNumber(data,5)
       Else
          ConvertValue = FormatNumber(0,5)
       End If
       ConvertValue = Replace(ConvertValue, ",", ".")
    End If
End Function

VTW User Interface

Shopping Cart