Monday 21 March 2016

Delphi Seattle - Multi Device Applicaiton / Form - Change Color of Background

There are many ways to fill in the color of a form but these two are fairly simple options.

Option 1:  Use the predefined color options.
When you've typed out TAlphaColors. , hit Ctrl and Spacebar to see the pre-defined colour options:

procedure TMainForm.FormCreate(Sender: TObject);
begin
fill.Color := TAlphaColors.Blueviolet;
fill.Kind := TBrushKind.Solid;
end;


 

Option 2:  Use the hex.
This takes the form of $00BBGGRR. Fill out the details accordingly and then put your hex code in the bracket. As a general rule of thumb, always set the first letters to be 'FF':

procedure TMainForm.FormCreate(Sender: TObject);
begin
fill.Color := TAlphaColor($FF008000);
fill.Kind := TBrushKind.Solid;
end;



Useful links:
Embarcadero breakdown of color options:
http://docwiki.embarcadero.com/Libraries/XE6/en/System.UITypes.TAlphaColorRec#TAlphaColorRec_Colors
Here you can find the RGB six letter code for you colour
http://www.w3schools.com/colors/colors_picker.asp 
Colors in the VCL:
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Colors_in_the_VCL
 

1 comment: