I searched, but have no clue what to do. I have a small picturebox(34x34 pixels) and want to have a transparent label(maybe 12x12 or 15x15 pixels) in the corner of it, which will be used as a counter.

I saw another forums suggesting adding the PictureBox as a parent to the Label, like this:

Label1.Parent = PictureBox1
Label1.BackColor = Color.Transparent

But then the label just disappears, and no text is displayed.

Label1.Parent = PictureBox1
        Label1.BackColor = Color.Transparent
        Label1.BringToFront()
        Label1.Location = New Point(20, 20)
Comments
Excellent. I had the same idea, but missed that Location point, damn :)

For some reason it actually does work. Have you tried to change the text's color: Label1.ForeColor = Color.White ?

Here's the code I tested and it works fine

Label2.Parent = PictureBox1
Label2.BackColor = Color.Transparent
Label2.BringToFront()
Label2.ForeColor = Color.White
Label2.Text = "foo bar"
Label2.Location = New Point(20, 20)

PictureBox1.Image = Image.FromFile("D:\image.jpg")

The key, apparently, is the line:
Label2.Parent = PictureBox1

Before doing that, I had the same problem. Adding that single line fixed the issue. Interestingly, that "parent" property doesn't seem to be exposed to the VB 2008 IDE, but it does show up in intellisense.

I'm no longer working on this project, so consider it closed, thanks for trying guys.

This will work folks,
LblInit.Parent = PbAnimated

   LblInit.Parent = PbAnimated
        LblInit.AutoSize = True
        LblInit.Location = New Point(0, 0)
        LblInit.BackColor = Color.Transparent
        LblInit.BringToFront()
        LblInit.ForeColor = Color.Black
        LblInit.Text = "Initialising..Please wait..."


    LblInit.Location = New Point(0, 0)
    LblInit.BackColor = Color.Transparent
    LblInit.BringToFront()
    LblInit.ForeColor = Color.Black
    LblInit.Text = "Initialising..Please wait..."
This article has been dead for over six months. Start a new discussion instead.