0

I am trying to make a row color have 74% transparency.

My code:

TDBGrid(sender).canvas.brush.color := RGB(0,176,240);

But I can't figure out where to add transparency to brush?

milanbalazs
  • 4,811
  • 4
  • 23
  • 45
glen morse
  • 25
  • 7
  • Please provide some more information regarding what you have behind the `TDBGrid` or its rows that you want to be partly visible? The answer depends on this. Also, is this VCL or FMX – Tom Brunberg Nov 18 '19 at 17:23
  • Vcl. And just the background color of the rows – glen morse Nov 18 '19 at 22:39
  • But then I don't understand why you are concerned with transparency. Look at [this answer](https://stackoverflow.com/a/57268412/2292722) showing how to specify the background color in the `OnDrawColumnColumnCell()` event (note, you need to set `DBGrid1.DefaultDrawing := False;`) – Tom Brunberg Nov 19 '19 at 09:04
  • In case you mean to blend your color with the standard gray color of forms, you could convert to HSL color model and change saturation to 26, which converted back to RGB gives RGB(89, 135, 151). Or, if you want to blend your color with a white background, you could convert to HSV model and change saturation to 26, which conversted back to RGB gives RGB(178, 223, 240). The latter, IMO, looks better as a background color. (Disclaimer: I have no formal knowledge about the color spaces mentioned, just throwing out my layman ideas on the matter.) – Tom Brunberg Nov 19 '19 at 09:05

1 Answers1

0

gdi+ can support alpha channel for color, you can use gdi+ functions in any canvas

  • This is a comment to the original post (if you had the comment privilege), but it's not an answer as currently posted. – Ken White Nov 19 '19 at 13:48