开发者

Color alpha-channel in DataGridView

开发者 https://www.devze.com 2023-02-05 12:22 出处:网络
How do I color a cell in a datagridview with the alpha-channel? 开发者_开发百科 RGB works ok, but when specifying the alpha I get distorted numbers instead. I make this color change in the cellPaintin

How do I color a cell in a datagridview with the alpha-channel? 开发者_开发百科 RGB works ok, but when specifying the alpha I get distorted numbers instead. I make this color change in the cellPainting event.

Color alpha-channel in DataGridView

 e.CellStyle.BackColor = Color.FromArgb(120, 255, 0, 0)


Well, it's working. Your screen shot shows the cell in the 3rd row getting different values and getting repainted without the BackColor erasing what was there before. It's several digits drawn on top of each other, looks like a 4, 5 and 6. You get more interesting effects by making the DGV smaller so a horizontal scrollbar appears. Dragging it produces a 'smear' of digits.

This just doesn't work very well, not sure why you want to do this. You want a good opaque background to draw new values on. That requires an alpha of 255.

0

精彩评论

暂无评论...
验证码 换一张
取 消