all groups > dotnet compact framework > april 2004 >
You're in the

dotnet compact framework

group:

Transparent Icon Problem


Transparent Icon Problem Drew
4/15/2004 9:32:48 PM
dotnet compact framework:
Having trouble with a transparent application icon:

It's black where it should be transparent.

I've soft reset the device many times, but it's still black.

This is strange because I have other transparent
icons which work as expected.

The icons are 32x32 and 16x16 at 256 colors.

I've gone to just coloring in the transparent portions
with white, but this is not ideal.

Any ideas?

Drew


Re: Transparent Icon Problem rimfire NO[at]SPAM lexicon.net
4/15/2004 11:09:21 PM
[quoted text, click to view]


This is a straight forward fix, but I believe you have to convert the
ico to a bmp for it to work correctly?

In class instantiation
----------------------
public static Bitmap bLogo;

In say form load
----------------
bLogo = new Bitmap(System.Reflection.Assembly.GetExecutingAssembly().
GetManifestResourceStream("GUIFramework.images.yourimage"));

In your paint event:
-------------------
protected override void OnPaint(PaintEventArgs e)
{
try
{
Graphics g;
g = CreateGraphics();
ImageAttributes att = new ImageAttributes();
// make the white section of the logo transparent so the
// backcolor of form shows through
att.SetColorKey(Color.White ,Color.White );
int h = global_form.bLogo.Height;
int w = global_form.bLogo.Width ;
Rectangle img = new Rectangle( 1,1,w,h );
g.DrawImage( global_form.bLogo,
img,1,1,w,h,GraphicsUnit.Pixel,att);
}
catch {}
}
base.OnPaint (e);
}

That should do the job - in the example I have embedded the image as
part of the EXE. As an enhancement you could load all the images into
a bitmap array and play with that.

good luck

Re: Transparent Icon Problem Drew
4/16/2004 8:12:37 AM
Huh?

I'm not trying to draw an image.

This is the icon for the application that you
see in the "programs" folder or with the
file explorer.

I still don't see why one icon would work
with transparency, and another would show
up as black. Could it be something with
the color table of this specific icon?

Drew


Re: Transparent Icon Problem Drew
4/16/2004 8:31:24 AM

[quoted text, click to view]

OK. I tried using the XOR color and it does give a white background.

However, this is still not the same as a transparent background.

Drew






Re: Transparent Icon Problem Lloyd Dupont
4/16/2004 1:13:35 PM
I had similar problemand used an almost good workaround.
for the application icon I use the XOR color (the computer iwth pink screen)
instead of the transparent one and it gaves me a white background

--
ihookdb
Get your data mobile
http://www.ihookdb.com


[quoted text, click to view]

AddThis Social Bookmark Button