transparent textboxes - quick question

G

Guest

Hi,
I found this online:
"If the SupportsTransparentBackColor bit is set to true, and the BackColor
is set to a color whose alpha component is less than 255, OnPaintBackground
will simulate transparency by asking its parent control to paint the
background."

What I've tried to do is this:
On the main form declared private TbJob tbJob (this is the textbox), as well
as set tbJob.Parent = pbEBS; (the picturebox I want as the background). Then
there's:
public class TbJob:TextBox
{
protected override void OnPaintBackground(PaintEventArgs e)
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint,true);
this.SetStyle(ControlStyles.DoubleBuffer,true);
this.SetStyle(ControlStyles.UserPaint,true);
this.SetStyle(ControlStyles.SupportsTransparentBackColor,true);
this.BackColor = Color.FromArgb(0,255,0,0);
}
}

I've set all the things that the online help says to set, and I can't figure
out what I'm missing.

Thanks very much for any help!
Melanie
 
J

J.Marsch

Melanie:

I'm afraid that I have bad news for you. The textbox control that you get
with the .Net runtime does not support transparency -- even if you alter the
create params to configure transparency. You're going to have find a
third-party control that does.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top