Reputation: 840
I have a Cell with a ColorCombo editor and adjacent to it a cell with some text. I want to dynamically change the colour of the text in the adjacent cell as I select different colours in my ColorCombo editor.
I haven't found a way to access the Canvas of the adjacent cell so I can change the colour
Upvotes: 0
Views: 2261
Reputation: 973
From TMS Documentation :
" Cell properties can also be set directly. Using this approach of course requires more memory as the properties are stored with each cell. Possible properties are:
property Alignments[Col,Row: Integer]: TAlignment;
property Colors[Col,Row: Integer]: TColor; property ColorsTo[Col,Row: Integer]: TColor;
property FontColors[Col,Row: Integer]: TColor;
property FontStyles[Col,Row: Integer]: TFontStyles;
property FontSizes[Col,Row: Integer]: Integer;
property FontNames[Col,Row: Integer]: string;
Example: setting a cell 2,3 to red background, bold Tahoma font and right aligned
Grid.Colors[2,3] := clRed;
Grid.FontStyles[2,3] := Grid.FontStyles[2,3] + [fsBold];
Grid.FontNames[2,3] := ‘Tahoma’;
Grid.Alignments[2,3] := taRightJustify;
Note: the property grid.ColorsTo[Col,Row: Integer]: TColor is used for specifying vertical gradients in cells from color set by Colors[] to color set by ColorsTo[]. "
Upvotes: 2