MakeTransparent vs TransparencyKey ?

A

Anthony Hughes

I've got a form which uses a background bitmap to create an irregular shaped
window.

According to KB822495 you need to use both MakeTransparency on your bitmap and
then set TransparencyKey on the form to get around a bug when redering on
24pdd or greater displays.

The problem I've got is that the MakeTransparent call then causes black text
on my form to become partially transparent, even though I'm using pure magenta
as my transparency colour for both the bitmap and the form.

Any ideas wht this is happening? What exactly does MakeTransparent do to the
bitmap?

Cheers
Ant
 
B

Bob Powell [MVP]

MakeTransparent changes the alpha settings for specific colours in the
bitmap. The effect is cumulative so if you use the commands
MakeTransparent(Color.Black) and MakeTransparent(Color.Magenta) then BOTH
the black and the magenta will become transparent.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
A

Anthony Hughes

MakeTransparent changes the alpha settings for specific colours in the
bitmap. The effect is cumulative so if you use the commands
MakeTransparent(Color.Black) and MakeTransparent(Color.Magenta) then BOTH
the black and the magenta will become transparent.

Thanks Bob - that clarifies things.... But - if form transparency only
supports colour keying, not alpha transparency I'm not sure I understand why
this step is necessary, or why it then turns Black transparent....

Cheers
Ant
 

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