问题
The question is about creating a transparent background in the TStringGrid control. The idea was to modify the white color that is created by default in the grid and use a null color, but I have not succeeded. I share here what has been done so far.
After researching the issue, I was able to show some transperence in the StringGrid by modifying the opacity property, through "Edit Custum Style" in the Background section. This solution is not perfect because it affects the associated TScrollBox control, but at least it is a first approach.
回答1:
The design of the FMX TStringGrid has no property to make it transparent. However, using styles, transparency can be achieved. You don't need to use styles on the whole application if you don't want to, but you can if you do.
The solution is a simple setting in the style of the grid according to following:
Add a TStringGrid to an Fmx form
- Right click the grid and select
Edit Default style - The style editor opens. In
structureselectgridstyle - background - content - In the properties of
content, locateClipParentand set toTrue - Click on
Apply and Closeto close the style editor
You now have a grid where the area under the header is transparent. If you have more rows (default is 100) than fits, you will also have the scrollbar on the right.
You can remove the header by setting Options.Header = False in TStringGrid properties.
I just noticed that you have found some solution too, however relying on Opacity settings can be tricky, because it affects potentially also other parts of the grid, perhaps in your case, if you select the content and adjust its opacity?.
来源:https://stackoverflow.com/questions/59086807/transparent-background-tstringgrid