TadvStringGrid fixed col/row brush

Hello,

I created a new project with only a default AdvStringgrid without changing any property.

I implemented the event GetCellColor with this code :

ABrush.Style := bsSolid;
If ((Arow mod 2)<>0) Then ABrush.Color := clwhite else ABrush.Color := $00F4F3EE;

The resulat I have : image

Why fixed col/row print a gradient instead of solid color ?

Thanks in advance

Please turn gradients off for fixed cells:

procedure TForm1.AdvStringGrid1GetCellColor(Sender: TObject; ARow,
  ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont);
begin
  ABrush.Style := bsSolid;
  if ((Arow mod 2)<>0) then
    ABrush.Color := clwhite
  else
    ABrush.Color := $00F4F3EE;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  advstringgrid1.ControlLook.FixedGradientTo := clNone;
  advstringgrid1.ControlLook.FixedGradientMirrorFrom := clNone;
  advstringgrid1.ControlLook.FixedGradientMirrorTo := clNone;
  advstringgrid1.TMSGradientTo := clNone;
end;

Perfect thank you !

TMSGradientTo seems to not be available on the component editor, so it can only be set to clNone programmatically right ?

Yes, it is a public property.
The alternative for design-time would be to select a grid.Look setting with a solid fixed cell color.

Ok, a big thank you for the reactivity :grinning:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.