0

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.

8
Contributors
10
Replies
136
Views
7 Years
Discussion Span
Last Post by Yunoos Shiddique
Featured Replies
  • 1
    __avd 1,826   7 Years Ago

    [CODE] Label1.Parent = PictureBox1 Label1.BackColor = Color.Transparent Label1.BringToFront() Label1.Location = New Point(20, 20) [/CODE] Read More

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

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")
0

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.

0

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

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.