how to make a label box transparent
dear all,
I am making my first software application using dot net ( VB) after using old versions of VB for 5 years. so i am a little bit experienced.
what i want to do is very simple, I want to use a label box with transparent background.
We usually do it in vb6 with backstyle property.
Likely it is not found here.
Could anyone tell me how to do it.
THX in advance
Re: how to make a label box transparent
Insert a Panel control in your form having transparent backcolor.
Place a Label inside the panel and the label will be transparent.
Re: how to make a label box transparent
Hi Oreo,
The way you suggest that put the label on one panel seems doesn't work. What I want to do is put one label on one picturebox and same times make the label transparent, not to block the picture.
Thanks for help in advance.
Robert
Re: how to make a label box transparent
search the codebank
wossname made a transparent label control
Re: how to make a label box transparent
Quote:
Originally Posted by MrPolite
search the codebank
wossname made a transparent label control
Ahemmm, its was a joint effort. ;)
:D
Re: how to make a label box transparent
I was never satisfied with that transparent label, too jaggy. Irrevocably jaggy in fact, no way to smooth it. Worked better with big fonts.
Re: how to make a label box transparent
Quote:
Originally Posted by RobDog888
Ahemmm, its was a joint effort. ;)
:D
ah that rat never admitted it:D
Re: how to make a label box transparent
Quote:
Originally Posted by wossname
I was never satisfied with that transparent label, too jaggy. Irrevocably jaggy in fact, no way to smooth it. Worked better with big fonts.
Is that because you couldn't use anti-aliasing because the region was limited to the string?
Re: how to make a label box transparent
Antialiasing can not be used with the GraphicsPath class, but I believe now that wossy has figured out a way to include antialiasing but not on a label, just direct draw so may be hard for design time viewing.
Re: how to make a label box transparent
Not entirely correct guys...
* You can use Antialiasing with GraphicsPaths and any kind of drawing (except PathGradientbrushes for some reason).
* You cannot use Antialiasing at the edges of regions because a region is defined by a hard edge of pixels, there is nowhere to put the interpolated pixels.
Quote:
Originally Posted by grilkip
Is that because you couldn't use anti-aliasing because the region was limited to the string?
The thing about creating a region form a curvy text outline, is that it takes a smooth curve and makes it jaggy.
You can use antialiasing on graphicspaths, but not when the region you are paint on is the same shape, the antialiased pixels fall off the edges and you can't tell the difference anyway because you are left with the jagged pixel edge of the region.
Rob, have you tried inheriting from the Panel class? That might be easier than using regions. I have not tried it yet. Might be worth a look. If you do, let me know how you get on.
Re: how to make a label box transparent
Quote:
Originally Posted by wossname
Not entirely correct guys...
You can use antialiasing on graphicspaths, but not when the region you are paint on is the same shape, the antialiased pixels fall off the edges and you can't tell the difference anyway because you are left with the jagged pixel edge of the region.
Maybe I didn't put right but that is in fact what I meant. :cool:
Re: how to make a label box transparent
wossname, I have done tons of inheriting of the Panel control in classes and I'm sick of it. :lol: You remember my Panel usercontrol? :D Probably will be starting back on it. almost done. But yes, inheriting a panel and then drawing on it may be better since you can make a panel truely transparent.
Re: how to make a label box transparent
I haven't seen the code for the control in the code bank..Is it using an overriden OnPaint method?
Re: how to make a label box transparent
btw have you guys tried setting the Region property of the control to the visible text's region?
Re: how to make a label box transparent
Quote:
Originally Posted by MrPolite
btw have you guys tried setting the Region property of the control to the visible text's region?
Yes, thats what the "joint-effort" was all about. Didn't work well. It was pseudotransparent... The text was solid but the rest of the control simply didn't exist, thus letting the background show through. Not pretty to look at but it was quite cool. Strangely, this made the font a few percent smaller than the original font was declared as, not sure why, couldn't find a way to fix that either.
We also tried hiding the control, taking a screenshot of the underlying pixels, re-showing the control again and blitting back the pixels on top. Then antialiasing our text on top of that! That didn't work either because it flickered like crazy and was dead slow to refresh. Then I got bored of debugging API functions and gave up until now.