Reputation: 31
When I use LabelAngle(i).BackColor = Color.Transparent something else show up.
![LabelAngle(i).BackColor = Color.Transparent][1]
LabelAngle(i) = New Label
LabelAngle(i).Parent = canvas
LabelAngle(i).AutoSize = True
LabelAngle(i).ForeColor = System.Drawing.Color.DodgerBlue
LabelAngle(i).Location = New System.Drawing.Point(Xstart(i) - 30, ReferenceY - BarHeight)
LabelAngleValue(i) = 180 - randAngle(i)
LabelAngle(i).Text = LabelAngleValue(i).ToString + "°"
LabelAngle(i).TextAlign = ContentAlignment.BottomLeft
LabelAngle(i).BackColor = Color.Transparent
LabelAngle(i).BringToFront()
Upvotes: 3
Views: 55627
Reputation: 33
As several people have noted on here, transparency is relative to the parent object; meaning that instead of truly becoming transparent, your object's backcolor will be set to match its parent object.
Another important thing to note, when you change a parent relationship, the child's location becomes based upon the location of the parent. This was a problem I was having for sometime. When I tried to change the parent of my object, my object kept disappearing, until I realized that it was really being moved off screen because its location was based upon the parent and I was setting it based upon the form.
Upvotes: 0
Reputation: 1
Double click in your Form and type this (this worked for me): Ex:
Private Sub formName_Load(sender As Object, e As EventArgs) Handles MyBase.Load
labelName.BackColor = System.Drawing.Color.Transparent
End Sub
Upvotes: 0
Reputation: 1117
Just type the colour code 16777215
into the BackColour property
Upvotes: 5
Reputation: 1512
To make a label transparent you need to set the forms transparencykey to lets say maroon "or a color you never will use".
Then if you set the label Backcolor to Maroon it will be transparent.
"But it will never show the control under it"
Upvotes: 3