Red TransparencyKey Not Working on Non Development Computer

I created a simple program that does little more than display a 
bitmap on the screen so that I could try out the TransparancyKey 
property. Any color in the window that matches the TransparencyKey 
should be transparent, so that users see whatever is behind the 
window at those points, rather than the window itself.

I set FormBorderStyle to none, BackgroundImage to an embedded 
bitmap, BackColor to Red and TransparencyKey to Red. The bitmap is 
the same size as the window's client area. It uses only two colors, 
Green and Red. The Red it uses is the same as the TransparencyKey.

After building the application, if I run the resulting exe outside 
the IDE on my computer, it works as I intended. Only the green part 
of the bitmap shows up, and anything behind the app's window shows 
up where the bitmap is red.

If I copy the exe to my wife's computer and run it, she sees the 
red areas. It is not transparent.

I then created an install project to install the program, but got 
the same result.

What am I doing wrong?


-- 
Greg
http://www.spencerbooksellers.com
newsguy -at- spencersoft -dot- com
0
Gregory
4/3/2010 10:22:34 PM
dotnet.languages.vb 830 articles. 0 followers. Follow

4 Replies
1053 Views

Similar Articles

[PageSpeed] 34

Gregory,

"Gregory A Greenman" <see@sig.below> schrieb:
>I created a simple program that does little more than display a 
> bitmap on the screen so that I could try out the TransparancyKey 
> property. Any color in the window that matches the TransparencyKey 
> should be transparent, so that users see whatever is behind the 
> window at those points, rather than the window itself.
> 
> I set FormBorderStyle to none, BackgroundImage to an embedded 
> bitmap, BackColor to Red and TransparencyKey to Red. The bitmap is 
> the same size as the window's client area. It uses only two colors, 
> Green and Red. The Red it uses is the same as the TransparencyKey.
> 
> After building the application, if I run the resulting exe outside 
> the IDE on my computer, it works as I intended. Only the green part 
> of the bitmap shows up, and anything behind the app's window shows 
> up where the bitmap is red.
> 
> If I copy the exe to my wife's computer and run it, she sees the 
> red areas. It is not transparent.

Make sure the computer's color depth is set to 32-bit.

-- 
 M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
 V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
0
Herfried
4/3/2010 10:57:53 PM
On Sun, 4 Apr 2010 00:57:53 +0200, Herfried K. Wagner [MVP] wrote: 
> Gregory,
> 
> "Gregory A Greenman" <see@sig.below> schrieb:
> >I created a simple program that does little more than display a 
> > bitmap on the screen so that I could try out the TransparancyKey 
> > property. Any color in the window that matches the TransparencyKey 
> > should be transparent, so that users see whatever is behind the 
> > window at those points, rather than the window itself.
> > 
> > I set FormBorderStyle to none, BackgroundImage to an embedded 
> > bitmap, BackColor to Red and TransparencyKey to Red. The bitmap is 
> > the same size as the window's client area. It uses only two colors, 
> > Green and Red. The Red it uses is the same as the TransparencyKey.
> > 
> > After building the application, if I run the resulting exe outside 
> > the IDE on my computer, it works as I intended. Only the green part 
> > of the bitmap shows up, and anything behind the app's window shows 
> > up where the bitmap is red.
> > 
> > If I copy the exe to my wife's computer and run it, she sees the 
> > red areas. It is not transparent.
> 
> Make sure the computer's color depth is set to 32-bit.


Hi, thanks for the fast response.

Since my previous post, I also tried this on my laptop computer. It 
has the same problem.

Checking both my laptop and my wife's computer, both are set to 32-
bit.

I checked the color depth of the bitmap itself. It was set to 24. I 
tried changing that to 32, but VS wouldn't let me. I then changed 
it to 8. That made no difference. It still worked on my development 
computer but failed on the other two.

Is there anything else I should try?



-- 
Greg
http://www.spencerbooksellers.com
newsguy -at- spencersoft -dot- com
0
Gregory
4/5/2010 7:18:33 AM
Can't make it work here, too. WinXP, desktop bit depth=32.
It works with the form's backcolor but not with a Backgroundimage.

-- 
Armin
0
Armin
4/5/2010 11:19:11 AM
On Mon, 05 Apr 2010 13:19:11 +0200, Armin Zingler wrote: 
> Can't make it work here, too. WinXP, desktop bit depth=32.
> It works with the form's backcolor but not with a Backgroundimage.


Okay, I've found the answer to this. This is a known bug with a 
work around.

http://support.microsoft.com/kb/822495

According to MS's article, if the computer's color depth is set to 
less than 32 bits it should work. I have now confirmed this on both 
my laptop and my wife's computer. I don't know why it worked on my 
development computer even with a 32 bit color depth.

The article also gives a way that should allow this to work without 
changing a user's color depth. I haven't tried that yet.


-- 
Greg
http://www.spencerbooksellers.com
newsguy -at- spencersoft -dot- com
0
Gregory
4/5/2010 8:59:37 PM
Reply:

Similar Artilces: