Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# Control - Transparent Label
Message
 
À
09/10/2007 18:35:17
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01259615
Message ID:
01259913
Vues:
20
My project is one day old, and I'm hung up by something that is a mouse click in VFP.

When I said I have no code I meant I havn't added any code. All I'v done is drop a panel and some images onto the form.

I sent you an email. I must be missing something because this can't be that difficult.






>>I have no code.
>
>Well, of course there's code Kevin ... the code that's generated in the Designer.cs. But, nevermind ... this seems to work fine if the parent is a Form, or a Panel, or some other Control, but it doesn't seem to work if the parent is a PictureBox. There's a note on that link you showed that says this:
>
>Windows Forms controls do not support true transparency. The background of a transparent Windows Forms control is painted by its parent.
>
>The problem is this ... the label's parent is the Panel, not the PictureBox. I'm not sure you can make the PictureBox the parent of the label.
>
>~~Bonnie
>
>
>
>
>>
>>All I have done so far is place a Panel control on a form. I then added a PictureBox in the panel and set it's Image to a blue verticle gradient.
>>
>>I then placed a label in the Panel, over the gradient image, near the top. The label's background appears as a white rectangle.
>>
>>My website is down, othewise I would post a screenshot.
>>
>>As far as that code I found - I'm not sure where this code goes.
>>
>>
>>
>>
>>
>>
>>>Kevin,
>>>
>>>That article seems pretty straightforward to me, I'm not sure what you're not understanding.
>>>
>>>How about we try this ... post the relevant code here and maybe we'll be able to spot the problem.
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>>I'm still not getting it. Why can't I make a label transparent????
>>>>
>>>>I found this article, but I need help understanding what it's telling me to do.
>>>>http://msdn2.microsoft.com/en-us/library/wk5b13s4.aspx
>>>>
>>>>
>>>>
>>>>
>>>>>You'd need to set the control style to support transparency
>>>>>
>>>>>
>>>>> private bool _HacerTransparente;
>>>>>        public bool HacerTransparente
>>>>>        {
>>>>>            get { return _HacerTransparente; }
>>>>>            set
>>>>>            {
>>>>>                _HacerTransparente = value;
>>>>>
>>>>>                this.SetStyle(ControlStyles.SupportsTransparentBackColor, _HacerTransparente);
>>>>>                if (_HacerTransparente)
>>>>>                {
>>>>>                    BackColor = Color.Transparent ;
>>>>>                }
>>>>>                else
>>>>>                {
>>>>>                    BackColor = BackGroundColor;
>>>>>                }
>>>>>            }
>>>>>        }
>>>>>
>>>>>
>>>>>HTH,
>>>>>
>>>>>Enmanuel
>>>>>
>>>>>>I have tried both, and it has no effect. The label is not transparent.
>>>>>>
>>>>>>I have a panel control with a picturebox in it of a gradient. The label is then on top of the gradient. The label appears as black text inside a white rectangle.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>How do I set the background of a label to transparent?
>>>>>>>
>>>>>>>
>>>>>>>this.MyLabel.BackColor = System.Drawing.Color.Transparent;
>>>>>>>
>>>>>>>
>>>>>>>Or, from the PropertySheet's color picker, choose the Web tab to find the Transparent color.
>>>>>>>
>>>>>>>~~Bonnie
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform