Sign in to follow this  
Followers 0
exodius

_ChooseColor Conversion

4 posts in this topic

So I'm trying to figure out how to get both the colorref number and the RGB equivalent for a color when using _ChooseColor.

I need the colorref number because the ownerdrawn function I'm using requires it, but I also need the RGB equivalent so I can use it with GuiCtrlSetBkColor to indicate the color just chosen..

I don't really care whether it's RGB --> Colorref or Colorref --> RGB, I just can't find anything on how to go either way. ;)

Anybody have any ideas?

Share this post


Link to post
Share on other sites



Just convert the colorref to hex to get RGB or convert RGB to decimal to get colorref. ;)

Share this post


Link to post
Share on other sites

Just convert the colorref to hex to get RGB or convert RGB to decimal to get colorref. ;)

I figured it out, the conversion's actually already in Misc.au3, I just had to think to go see how they came up with the different color values. :D

From Misc.au3:

If ($iRefType == 1) Then ; BGR hex color to colorref
        $iColorRef = Int($iColorRef)
    ElseIf ($iRefType == 2) Then ; RGB hex color to colorref
        $iColorRef = Hex(String($iColorRef), 6)
        $iColorRef = '0x' & StringMid($iColorRef, 5, 2) & StringMid($iColorRef, 3, 2) & StringMid($iColorRef, 1, 2)
    EndIf

Share this post


Link to post
Share on other sites

I figured it out, the conversion's actually already in Misc.au3, I just had to think to go see how they came up with the different color values. ;)

From Misc.au3:

If ($iRefType == 1) Then ; BGR hex color to colorref
        $iColorRef = Int($iColorRef)
    ElseIf ($iRefType == 2) Then ; RGB hex color to colorref
        $iColorRef = Hex(String($iColorRef), 6)
        $iColorRef = '0x' & StringMid($iColorRef, 5, 2) & StringMid($iColorRef, 3, 2) & StringMid($iColorRef, 1, 2)
    EndIf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0