I am upgrading an app from vb6 to .net and found that all labels were converted to images because there is no transparent property anymore. Is there no way around this? :confused: :confused: :mad:
Printable View
I am upgrading an app from vb6 to .net and found that all labels were converted to images because there is no transparent property anymore. Is there no way around this? :confused: :confused: :mad:
Set the BackColor property to Transparent. ;)
no that doesnt work. That will just change the backcolor of the label to match the backcolor of the form.....Quote:
Originally posted by wyrd
Set the BackColor property to Transparent. ;)
I have a picturebox in my form which is supposed to be the background of the form, and I have some labels on my form. Since they;re not transparent, it looks kinda ugly :(
Actually it worked like a charm ... i have a custom skin that the imagebox sits on and you can see right through it just like the old labels did. Thanks for the tip wyrd
Mr. Polite ... Prob doesn't work for labels...i stuck with the imagebox's:D
eeh so what did you do? you made a transparent label? :confused: :DQuote:
Originally posted by Halon
Actually it worked like a charm ... i have a custom skin that the imagebox sits on and you can see right through it just like the old labels did. Thanks for the tip wyrd
Mr. Polite ... Prob doesn't work for labels...i stuck with the imagebox's:D
MrPolite:
I just added a background image to my form, then added a label with BackColor set to Transparent. It worked fine.
Note: The Transparent option is under the Web tab.
Hello MrPolite,
Ok I found a this at the MSDN site.
Giving Your Control a Transparent Background
In the Public Sub New section of your form add the following line after the "InitializeComponent()"
VB Code:
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Like below:
Then in the constructor section of the label add the following line.VB Code:
#Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call SetStyle(ControlStyles.SupportsTransparentBackColor, True) End Sub
Which will look like this:VB Code:
Me.Label1.BackColor = System.Drawing.Color.Transparent
Once you have all that done the label will be transparent from then on.VB Code:
' 'Label1 ' Me.Label1.BackColor = System.Drawing.Color.Transparent Me.Label1.Location = New System.Drawing.Point(28, 40) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(220, 68) Me.Label1.TabIndex = 0 Me.Label1.Text = "Label1"
Hope this helps a little...
hmmm .. seemed a lot easier to just set the backcolor to transparent like wyrd was mentioning. Is there a reason to do it the other way?
He was just telling you how to make images transparent.
I did that, but it's not working:
http://www.vbforums.com/attachment.php?postid=1293499
Try this:
Set the labels background property to this: 0,255,0,0
Jeremy
why not just put the label above the button? or can't it be done?
Are you setting the image in the form's BackgroundImage property? It doesn't work otherwise.
I tried stretching an image in a pciturebox over the form but all the 'transparent' controls then had the background that matched the form still. So they really aren't transparent, they just draw the form in the background.
well I have a picturebox under the label:D:D:DQuote:
Originally posted by Edneeis
Are you setting the image in the form's BackgroundImage property? It doesn't work otherwise.
I tried stretching an image in a pciturebox over the form but all the 'transparent' controls then had the background that matched the form still. So they really aren't transparent, they just draw the form in the background.
so what does that setStyle thingie do? redraw's the form's background in the transparent control? that's not gunno help me :(
I could make my own label control that would redraw the background in a certain picturebox, but that would probably be inefficient, like everything else that I try to do:(
Can you set the picture as the form backgroundimage instead of in the picturebox? Is it just me or does it seem like MS took a step backwards on this one?
I think they did take a step backwards:DQuote:
Originally posted by Edneeis
Can you set the picture as the form backgroundimage instead of in the picturebox? Is it just me or does it seem like MS took a step backwards on this one?
well I'm making a program, and the whole program is like a WIZARD, kinda like the way you burn CD's in nero. So I thought the best way to do something like this is to put each step of my program in a tabpage. So I have a tabcontrol, with some tabpages which contain the different steps of the program.... Each one has it's own background. I dont know if there is a better way besides using a tabcontrol for this