Jump to content
JusJJ

Grid background color

Recommended Posts

Is it somehow possible to change the background color and remove borders of the (string)grid in FMX?

I would like to align the data in a 4 x 10 grid but only keep the text visible and hide background and borders.

Share this post


Link to post

@JusJJ  I think that easy way would be:

  1. right-click on StringGrid and "Edit Custom Style..." option -> to create a StyleBook customized
  2. into it, you need just access 2 properties: StyleGrid1Style1 --> and change: "background -> Visible=false" and "linefill -> Brush.Kind = none"
  3. in StringGrid options, uncheck "Show Header"

image.thumb.png.9a4313d880238949a74167b12f52f7f5.png   image.thumb.png.1af2a789993ec9eb2ea01c53d3310f72.png

Edited by programmerdelphi2k

Share this post


Link to post

I found one problem. Changing background visible -> false it is impossible to change grid size and position at runtime.

Share this post


Link to post
5 hours ago, JusJJ said:

is impossible to change grid size and position at runtime.

here works, at least!

Quote

procedure TForm1.Button2Click(Sender: TObject);    /// StringGrind1 background = visible = false
begin
  Memo1.Lines.Add('Before: StringGrid1.Width=' + StringGrid1.Width.ToString);
  Memo1.Lines.Add('Before: StringGrid1.Height=' + StringGrid1.Height.ToString);
  //
  StringGrid1.Width      := 100;
  StringGrid1.Height     := 100;
  StringGrid1.Position.X := 100;
  StringGrid1.Position.Y := 100;
  //
  Memo1.Lines.Add('After: StringGrid1.Width=' + StringGrid1.Width.ToString);
  Memo1.Lines.Add('After: StringGrid1.Height=' + StringGrid1.Height.ToString);
end;

image.thumb.png.66b4ee3b6f33a4ef67ee397cec940437.png

Share this post


Link to post
On 5/24/2023 at 4:18 PM, programmerdelphi2k said:

here works, at least!

 

It works this way, but if you try to enlarge it, it doesn't work

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×