Handling transparency in a custom control

J

JezB

I'm creating a custom control (inheriting from base windows control
RadioButton). I want the background for the control to be transparent, so in
the OnPaint method the first thing I do is clear the client rectangle with a
transparent colour:

protected override void OnPaint(PaintEventArgs pea)
{
Graphics g = pea.Graphics;
g.Clear(Color.Transparent);

// now paint over this
}

but this is making the background black rather than transparent. Leaving
this out and just painting what I want while leaving areas of the client
rectangle unpainted leaves a residue from what was painted there before (eg.
when I uncheck the radio button). What am I doing wrong ?
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top