Tuesday, June 2, 2009

Colors in Ax

When using Ax, sooner or later you gonna use your own colors. But different functions in Ax (and extensions) require different definitions of these colors.

There are different coding system for colors. Some functions require the hexadecimal format, others expect an integer and so on.
Luckily, Ax comes with some built in functions to do the necessary conversions for you. Like this one:

WinApi::RGB2int() - Convert the red, green and blue values to an integer.
WinApi::RGBCon2int() - Dito, but with a container input
WinApi::RGBInt2con() - The opposite, converting from an integer to separate red, green and blue values

Or create your own functions, like this one for example:

static str int2RGBhex(int color)
{ container colorcon;
str colorhex;


return colorhex;

This function will convert an integer color value to a hexadecimal one.

Happy coding,


No comments:

Post a Comment