03-24-2012، 12:26 PM
با سورس زیر میتونید رنگ html رو میتونید به Rgb تبدیل کنید.
In this day and age you will find yourself at times needing to set a color in two different ways. If you are doing any sort of web development you will find that often you are referring to colors using a code that looks something like this '#0066FF'. On the other hand if you are doing development in Visual Basic it expects you to specify any colors by their Red, Green, and Blue values (hence RGB). Luckily you can write a simple code snippet to convert HTML colors into their RGB equivalents.
To do this creat a new Visual Basic application. Add a command button to it. Double click this button. Highlight everything in the code editor and delete it. Replace it with this code.
In this day and age you will find yourself at times needing to set a color in two different ways. If you are doing any sort of web development you will find that often you are referring to colors using a code that looks something like this '#0066FF'. On the other hand if you are doing development in Visual Basic it expects you to specify any colors by their Red, Green, and Blue values (hence RGB). Luckily you can write a simple code snippet to convert HTML colors into their RGB equivalents.
To do this creat a new Visual Basic application. Add a command button to it. Double click this button. Highlight everything in the code editor and delete it. Replace it with this code.
کد:
Function HTMLtoRGB(HtmlCode As String) As String
If Left(HtmlCode, 1) = "#" Then
HtmlCode = Right(HtmlCode, 6)
End If
RED = Left(HtmlCode, 2)
GREEN = Mid(HtmlCode, 3, 2)
BLUE = Right(HtmlCode, 2)
RgbHex = "&H00" + BLUE + GREEN + RED
HTMLtoRGB = "&" & Val(RgbHex)
End Function
Private Sub Command1_Click()
MsgBox HTMLtoRGB("0000FF")
End Sub
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg