Penny hapeny
2008-02-29 16:54:19 UTC
Hi All,
I have been experimenting with creating a function.
Its purpose is to create the Hex values of a range of Colors
and display them in a Label1 as the Color and in Label2 as the Hex value
of that Color, and finally to save the Hex value in an array for later
access.
My code now works Ok but the Label2 displays the Color value as a
decimal value. all my attempts to change it to a Hex value have failed.
These are just a few lines from my code.
// for(loop this is only for Red zr)
for( zr=0x4e; zr<=0xFF; (zr=zr+0x3b))
{
zt=zr; // Just to save zr for wnen the for(loop) is about to terminate
Label1->Color = zr+zg+zb;
ColorArray[x] = zr+zg+zb;
zc = zr+zg+zb; // zc is the complete color value.
y++; // Just to note how many times we have gone round the loop
Label1->Color = ColorArray[x];
// Sleep(1000); // delay for 1 sec
x++;
Label2->Caption = IntToStr (zc); // THIS DISPLAYS MY VALUE BUT IT'S
A DECIMAL NOT HEX
Label3->Caption = IntToStr (y);
Refresh();
}
}
while(y<=72); // Main loop see 'do'
In the header file I define the following
long ColorArray[80]; // Stores the Hex value for the 76 Colors
int x; // array index
int y; // Incrementor to show total number of Colors
long zt,zr,zg,zb,zc; // z Temp, z Red, z Green, z Blue, z
Combined.
I hope I have made my self clear.
Thanks
Penny
I have been experimenting with creating a function.
Its purpose is to create the Hex values of a range of Colors
and display them in a Label1 as the Color and in Label2 as the Hex value
of that Color, and finally to save the Hex value in an array for later
access.
My code now works Ok but the Label2 displays the Color value as a
decimal value. all my attempts to change it to a Hex value have failed.
These are just a few lines from my code.
// for(loop this is only for Red zr)
for( zr=0x4e; zr<=0xFF; (zr=zr+0x3b))
{
zt=zr; // Just to save zr for wnen the for(loop) is about to terminate
Label1->Color = zr+zg+zb;
ColorArray[x] = zr+zg+zb;
zc = zr+zg+zb; // zc is the complete color value.
y++; // Just to note how many times we have gone round the loop
Label1->Color = ColorArray[x];
// Sleep(1000); // delay for 1 sec
x++;
Label2->Caption = IntToStr (zc); // THIS DISPLAYS MY VALUE BUT IT'S
A DECIMAL NOT HEX
Label3->Caption = IntToStr (y);
Refresh();
}
}
while(y<=72); // Main loop see 'do'
In the header file I define the following
long ColorArray[80]; // Stores the Hex value for the 76 Colors
int x; // array index
int y; // Incrementor to show total number of Colors
long zt,zr,zg,zb,zc; // z Temp, z Red, z Green, z Blue, z
Combined.
I hope I have made my self clear.
Thanks
Penny