Label with Transparency ?

  • Thread starter Thread starter Mobile Boy 36
  • Start date Start date
M

Mobile Boy 36

Hi,

I would like to create an application in Vb.net with an image in the
background.
I use a picturebox, set at the background.
But to make an attractive application I would need a label with
transparency.
In that case, the picture would not be disturbed by the labels..

Is there a(n) (easy) solution for this problem?

Best regards,
Kevin
 
If you want the picture to be the background of your entire form, you can do
what I do for this. I override the paint event of the form and paint the
background pic and paint text on the form instead of using labels. Here is
an example of my overrided paint event. The bmp variable was set ealier to
the bitmap I want for the background.

--------------------

protected override void OnPaint(PaintEventArgs e)
{
Bitmap offscreenBitmap = new Bitmap(240, 300);
Graphics g = Graphics.FromImage(offscreenBitmap);

g.Clear(this.BackColor);

g.DrawImage(bmp, 0, 0);

Font f;
Brush b;
Rectangle r;

// This code will draw the text that displays my application name
f = new Font("Arial", 20, FontStyle.Bold);
b = new SolidBrush(Color.White);
r = new Rectangle(5, 5, 240, 40);
g.DrawString(Global.AppName, f, b, r);

// This code will draw the text that displays the version number
f = new Font("Arial", 10, FontStyle.Bold);
b = new SolidBrush(Color.White);
r = new Rectangle(5, 35,240, 20);
Version v =
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
string ver = "Version " + v.ToString();
g.DrawString(ver, f, b, r);

// This code will draw the text that displays my copyright
r = new Rectangle(5, 55, 240, 20);
g.DrawString("Copyright (c) 2003 Mark Reddick", f, b, r);

base.OnPaint (e);
}
 
Back
Top