Can not change any of the colors of the attached AdvStringGrid: TAdvGridDropDown.Grid. Trying to change at run-time.
// The first is only one that works
AdvGridDropDown1.Color := clRed;
// Next 5 have no effect
AdvGridDropDown1.SelectionColor := clAqua;
AdvGridDropDown1.Grid.SelectionColor := clWhite;
AdvGridDropDown1.Grid.GridLineColor := clLime;
AdvGridDropDown1.Grid.ControlLook.FixedGradientFrom := clBlue;
AdvGridDropDown1.Grid.SelectionColor := clFuchsia;
Many Thanks,
John
Please set grid.Look = glStandard.
Example:
procedure TForm1.AdvGridDropDown1BeforeDropDown(Sender: TObject);
begin
advgriddropdown1.Grid.Look := glStandard;
advgriddropdown1.Grid.SelectionColor := clRed;
advgriddropdown1.Grid.SelectionColorTo := clRed;
end;
Thanks for the speedy answer. Setting Grid.Look := glStandard does not enable grid colors in AdvGridDropDown.Grid.
TIA
Was retested with a default TAdvGridDropDown on the form and the code:
uses
AdvGrid;
{$R *.dfm}
procedure TForm1.AdvGridDropDown1BeforeDropDown(Sender: TObject);
begin
advgriddropdown1.Grid.Look := glStandard;
advgriddropdown1.Grid.SelectionColor := clRed;
advgriddropdown1.Grid.SelectionColorTo := clRed;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
advgriddropdown1.Items.Add;
advgriddropdown1.Items.Add;
advgriddropdown1.Items.Add;
end;
and this shows a red selection color. What is different in your app?
Ah Ha. That fixed it. I was executing the color changing code in Form.Create/Form.Activate.
Thanks again
John
How do I give Fixed Rows and Columns a different Color. Would like set dark grey gradient for these Fixed Cells (eg: XColor, YColorTo).
You can set the fixed cell background color with properties
grid.ControlLook.FixedGradient*
Did a bit of work and discovered only AdvGridDropdown.Grid.Look: glTMS and lXP allow all grid color changes. Two colors do not work and appear as white in the attached image:
1) AdvGridDropdown1.Grid.ControlLook.FixedGradientFrom := clLime;
The top gradient color of Fixed Cells.
2) The Grid Cells that are not selected. These appear as white cells in the attached image.
Please take a look
The glStandard, glClassic, glSoft look forces the fixed cell colors to clBtnFace. This can also be seen in the standalone TAdvStringGrid component.