Results 1 to 9 of 9

Thread: [RESOLVED] Colors

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Resolved [RESOLVED] Colors

    i want to make a labels background color white using the hex(FFFFFF) of rgb colors, how can i do that?
    i need to make it in the code, not change the color of it on the design i need it to be editable..

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Colors

    Have your tried: Label1.BackColor=&HFFFFFF ? Precede hex with &H
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Colors

    You can also do it the easy way with
    Code:
    Label1.Backcolor = vbWhite

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Colors

    i dont need that but i need to use the hex colors... please?

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Colors

    LaVolpe showed you how, what problems are you having with it?

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Colors

    oh, i didnt see his post, sorry. i'll try and edit when i've tried.


    EDIT:

    worked and thank you everyone that helper/and-posted.

    EDIT:

    if you know how about RGB?
    Last edited by Justa Lol; Dec 19th, 2008 at 12:51 PM.

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] Colors

    Regarding your last edited comment...
    With the exception of system colors which are negative values in VB (i.e., vbButtonFace), valid colors can be almost any format. Though most system colors can be used for vb controls, they cannot be used in APIs that expect color values.

    For example, White:
    1. vbWhite
    2. &HFFFFFF
    3. RGB(255,255,255) .... vb's RGB() function
    4. 16777215
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: [RESOLVED] Colors

    If you ever need to know the color value of a system color:
    Code:
    Private Declare Function OleTranslateColor Lib "oleaut32.dll" (ByVal ColorIn As Long, ByVal hPal As Long, ByRef RGBColorOut As Long) As Long
    
    ' Translate system color into its resulting color value
    Public Function SystemColorRGB(plngSystemColor As Long) As Long
        Const S_OK = &H0
        Dim lngReturn As Long
        
        If OleTranslateColor(plngSystemColor, 0, lngReturn) = S_OK Then SystemColorRGB = lngReturn Else lngReturn = -1
    End Function

  9. #9
    Addicted Member
    Join Date
    Apr 2008
    Posts
    198

    Re: [RESOLVED] Colors

    if you try to calculate the rgp color there is no way.
    you should know what each rgp code mean.
    IT CTO & System Administrator.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width