exodius Posted August 22, 2008 Share Posted August 22, 2008 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? Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 22, 2008 Share Posted August 22, 2008 Just convert the colorref to hex to get RGB or convert RGB to decimal to get colorref. Link to comment Share on other sites More sharing options...
exodius Posted August 22, 2008 Author Share Posted August 22, 2008 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. 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 Link to comment Share on other sites More sharing options...
exodius Posted August 22, 2008 Author Share Posted August 22, 2008 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now