Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
when i put a label on a panel witch have a background image , i put the background color of the label Transparent for see just the text on the panel, but it show the background of the form, how to fix?
live any day of your life like your last.
  • Leaders
Posted

You can't make the background of a label transparent.

 

You need to draw the text manually using the System.Drawing.Graphics

:)

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

  • Leaders
Posted

When the background of a label is set to transparent, the labels CONTAINER is drawn behind the transparent label, but no other controls. If you can see through the label to the form, perhaps the label isnt INSIDE the panel, NOT ON TOP. If this is the case then the form will be drawn through the label, but not the panel (it will look like the label cuts a hole in the panel).

 

You DO NOT need to draw the text manually (everyone seems to think otherwise). You just need to make sure that the control is actually inside what you want to show through the transparent control. If what you want to appear behind the transparent label is not a control container (and a panel IS a control container) and you can't substitute a control container control for what you are using, then in that case, YES, you do need to do it manually with the Graphics class.

[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted

I think that most all controls have a controls properity which you can access and add transparent labels.

       With Label2
           .Location = New Point(20, 20)
           .BackColor = Color.Transparent
           .BringToFront()
       End With
       PictureBox1.Controls.Add(Label2)

 

BUT...You have a lot more graphic options if the text is directly drawn onto the container control.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • Leaders
Posted
In VB6, picture boxes could contain other controls. In .NET, the picturebox can not. Only container controls and scrollable controls can contain other controls (for example, panels and group boxes)
[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted

I think if you do a cut and paste with my code you'll be suprised.

 

But...drawing the text directly onto the picture box will afford a lot more options, and is easy enough to do.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • *Experts*
Posted
I haven't tried it yet (I prefer to paint text onto objects rather than use transparent labels for many reasons) but I think that since all .NET controls are objects that this should work for all controls.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • Leaders
Posted
I don't understand what you mean... of course all controls are objects. Everything in .NET derives from the object class. What does that have to do containing other controls?
[sIGPIC]e[/sIGPIC]
Posted
you could try to override the background painting of the textbox and paint a paece of the background image of the parent object that way you will have that transparent look you might look fore

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...