Filling a Rectangle, Ellipse, Shape, etc. with a semi-transparent fill is done by using a SolidBrush with a Alpha value somewhere between solid and transparent.
C#:
Color col = Color.FromArgb(75, 100, 100, 100);
SolidBrush b = new SolidBrush(col);
g.FillRectangle(b, 0, 0, this.Width - 1, this.Height - 1);
VB.NET:
Dim col As Color = Color.FromArgb(75, 100, 100, 100)
Dim b As New SolidBrush(col)
g.FillRectangle(b, 0, 0, Me.Width - 1, Me.Height - 1)
For better examples, go to this link:
http://www.java2s.com/Code/CSharp/2D-Graphics/Filledwiththesemitransparentandtransparentcolor.htm
No comments:
Post a Comment