Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How i make a label's backcolor transparent on the picturebox ?

How i make a label's backcolor transparent on the picturebox ?

Scheduled Pinned Locked Moved Visual Basic
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Narenge
    wrote on last edited by
    #1

    i set the backcolor of label to Transparent and it's parent to picturebox but nothing appear in runtime :( ??? (picturebox exist under the label)

    M M T 3 Replies Last reply
    0
    • N Narenge

      i set the backcolor of label to Transparent and it's parent to picturebox but nothing appear in runtime :( ??? (picturebox exist under the label)

      M Offline
      M Offline
      Marcus J Smith
      wrote on last edited by
      #2

      Why are you putting a label OVER the picturebox? Are you sure that the picturebox is actually linked to an image and showing it?


      CleaKO

      "I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
      "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)

      N 1 Reply Last reply
      0
      • M Marcus J Smith

        Why are you putting a label OVER the picturebox? Are you sure that the picturebox is actually linked to an image and showing it?


        CleaKO

        "I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
        "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)

        N Offline
        N Offline
        Narenge
        wrote on last edited by
        #3

        Because i wanna make an image button user control component. Yes picture box linked to an image and i'm working with VB.Net 2005 platform. -- modified at 13:32 Tuesday 13th March, 2007

        1 Reply Last reply
        0
        • N Narenge

          i set the backcolor of label to Transparent and it's parent to picturebox but nothing appear in runtime :( ??? (picturebox exist under the label)

          M Offline
          M Offline
          M Hall
          wrote on last edited by
          #4

          With .Net I have not found a way to use transparency with labels and show the background like you can do with VB6. I have had to resort to keeping the label hidden and using it's text,location, etc. in the picture box's OnPaint event using a graphics object to draw the text on the picture box. Hope that helps :)

          1 Reply Last reply
          0
          • N Narenge

            i set the backcolor of label to Transparent and it's parent to picturebox but nothing appear in runtime :( ??? (picturebox exist under the label)

            T Offline
            T Offline
            TwoFaced
            wrote on last edited by
            #5

            I was able to add a label to a picturebox and it's transparency worked fine. How are you creating the label. Is it done at runtime or design time. Remember that the location of a control is relative to it's parent. So if the label exists at design time and is located 100 from the left and 200 from the top it will be in that same relative position when you set it's parent to the picturebox. What may be happening is when you set the parent to the picturbox the label is positioned where you can't see it. Try setting it's position to (0,0) and see if it shows up. As proof of concept try creating a new project. Add a label and a picturbox to your form as well as a button. To prove the transparency works give the picturbox an image. Then add this code.

            Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
                'Set the parent
                Label1.Parent = PictureBox1
                'Position the label so we can see it
                Label1.Location = New Point(0, 0)
                'Give it a transparent background
                Label1.BackColor = Color.Transparent
            End Sub
            
            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups