• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 5 رای - 2.6 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: Convert HTML Color to RGB
حالت موضوعی
#1
با سورس زیر میتونید رنگ 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.

کد:
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
 
پاسخ
  


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  ارسال متن کامل به html aghamali 5 6,223 11-03-2014، 05:58 PM
آخرین ارسال: aghamali
  Find Pixel Color With Visual Basic 6 Amin_Mansouri 0 3,031 02-27-2012، 09:48 PM
آخرین ارسال: Amin_Mansouri

پرش به انجمن:


Browsing: 2 مهمان