Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB6-Colors

Options
  • 28-08-2003 6:09pm
    #1
    Closed Accounts Posts: 5


    Hi There,

    Help ! .. I´m using a RGB(4,80,108) as Backcolor for some objects on a Form, but I have to code it in the Form Load, because this color is not available in the color properties list. What is the Hex color code of this color (&H00.. etc) ? How can I permanently include this color (or for that matter, any color) in the properties window of VB objects ??
    I´ll appreciate any help.
    MBran:confused:


Comments

  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Read the help :)

    Seriously...help for the ForeColor and BackColor properties tells you how to set it from an RGB set of values.

    How to permanently include it? No idea. I'd set a constant equal to the value and use that.

    jc


  • Closed Accounts Posts: 5 MBran


    Well, in design mode, the BackColor property refers to two sets of colors, "System" and "Palette", where one can just pick a color and give its value to this property. The point is, the number of color choices are limited and the nice thing would be a wider selection, for instance, if one could add a new/custom color to the "palette" or "System" set. I have a strong feeling that it can be done, maybe thinkering with a windows color file, etc. I don´t know how yet.


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    What I meant was that if you want to get the HEx value, the Help will tell you that an RGB function call will return the Long value..so you can write 1 line of code to throw the long value you want into a textbox.

    ...and then all you need to do is long 2 Hex that, and you have your value. Windows calculator should give you that, if there isn't a hex function in VB (which I'm pretty sure there is).

    If all you want to do is set it so that you can select it from the list of offered values in the property box, then choose palette. Right-click on ony one of the cells in the bottom two rows (they shoudld all appear white). Assign your RGB values there, giving you the colour you want. So you shouldn't even need the Hex value..

    That colour will now remain in your Palette, where you right-clicked, effectively forever (well, I haven't tried rebooting), until something overwrites it or reassigns to that palette location.

    The System colours are read directly from whatever windows colour scheme you have selected. They cause the app to reflect the current windows colour scheme consistently - whatever the user has implemented is what will be used. As such, it would be meaningless to try and use something there for a "fixed" colour.....if you see what I mean.

    jc


  • Closed Accounts Posts: 5 MBran


    That´s it !
    Thanks a lot !;)


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Yes there is a vb 6 function that returns a hex value, it's called Hex strangely enough. But why Hex?


  • Advertisement
  • Closed Accounts Posts: 5 MBran


    Tou´re right. Why Hex ? well, if a "new" color can be added to the "palette" property panel, no need to code that. But anyway, coding is a strong sticking habit of hex-programers...(no pun intended...) ;)


Advertisement