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. Transparent Label

Transparent Label

Scheduled Pinned Locked Moved Visual Basic
questionhelp
7 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.
  • M Offline
    M Offline
    morteza57
    wrote on last edited by
    #1

    Hi, I want create a Label with transparent Color as "Color.FromArgb(40, 0, 0, 255)" how can I do? Please help me

    G T 2 Replies Last reply
    0
    • M morteza57

      Hi, I want create a Label with transparent Color as "Color.FromArgb(40, 0, 0, 255)" how can I do? Please help me

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Please don't cross post.

      --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • M morteza57

        Hi, I want create a Label with transparent Color as "Color.FromArgb(40, 0, 0, 255)" how can I do? Please help me

        T Offline
        T Offline
        The ANZAC
        wrote on last edited by
        #3

        do it on the form_load event: label.backcolor = color.fromargb(40,0,0,255)

        Posted by The ANZAC

        M 1 Reply Last reply
        0
        • T The ANZAC

          do it on the form_load event: label.backcolor = color.fromargb(40,0,0,255)

          Posted by The ANZAC

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

          My problem is that Label did not transparent to other controls on form. in example : if you have a PictureBox on form and a Label over the PicturBox ,Back Color of Label Cover the pictureBox and Part of PictureBox that is behind of Label is not visible. How i can set transparent color to label for All controls;

          D 1 Reply Last reply
          0
          • M morteza57

            My problem is that Label did not transparent to other controls on form. in example : if you have a PictureBox on form and a Label over the PicturBox ,Back Color of Label Cover the pictureBox and Part of PictureBox that is behind of Label is not visible. How i can set transparent color to label for All controls;

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            It won't do that. There is a very common misconception that setting the BackColor to Transparent will make the label actually transparent. NO, it won't! When that control is redrawn, its Background takes on the background properties of it's parent container. It does NOT show other controls through it. In order to do this, you have to make your own label control, inheriting from the existing label. Override the it's OnPaintBackground method, and just don't paint that background and you should, in theory, get what you want.

            Dave Kreskowiak Microsoft MVP - Visual Basic

            M 1 Reply Last reply
            0
            • D Dave Kreskowiak

              It won't do that. There is a very common misconception that setting the BackColor to Transparent will make the label actually transparent. NO, it won't! When that control is redrawn, its Background takes on the background properties of it's parent container. It does NOT show other controls through it. In order to do this, you have to make your own label control, inheriting from the existing label. Override the it's OnPaintBackground method, and just don't paint that background and you should, in theory, get what you want.

              Dave Kreskowiak Microsoft MVP - Visual Basic

              M Offline
              M Offline
              morteza57
              wrote on last edited by
              #6

              Dear Dave Kreskowiak Thank You, but I found simple way. I add Label to PictureBox as : Label1.BackColor=Color.Transparent; PictureBox1.Controls.Add(Label1); in conclude Label1 is transparent to PictureBox Regards

              D 1 Reply Last reply
              0
              • M morteza57

                Dear Dave Kreskowiak Thank You, but I found simple way. I add Label to PictureBox as : Label1.BackColor=Color.Transparent; PictureBox1.Controls.Add(Label1); in conclude Label1 is transparent to PictureBox Regards

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                I must not be getting what you said in your original post. I thought you wanted the controls in the same container to show through the label. Apparently, that's not the case. From what I'm not gathering, you just wanted a picture to show through the label.

                Dave Kreskowiak Microsoft MVP - Visual Basic

                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