I use a transparent background for the PictureBox
control.
But I also want to be able to paint with a %50 opacity blue FillRectangle
.
How to do this?
I use a transparent background for the PictureBox
control.
But I also want to be able to paint with a %50 opacity blue FillRectangle
.
How to do this?
.NET WinForm controls themselves do not support transparency, but GDI+ does as far as general rendering goes. If you are rendering onto a PictureBox (or onto anything else) and want to render something with partial opacity, then create a color with an alpha value less then 255 (opaque) and use it to create a brush or pen.
For example:
Color c = Color.FromArgb(128, Color.Blue);
using (Brush b = new SolidBrush(c))
{
e.Graphics.FillRectangle(b, 0, 0, 50, 50);
}