hi,All

I have a gif image(done by photoshop, and the background is transparent)
I want to draw it on my forms.
But the background is not transparent.

How to do it?

I try source below:but it does not work?

ImageAttributes imageAttr = new ImageAttributes();
imageAttr.SetColorKey(Color.FromArgb(0,255,0),Color.FromArgb(0,255,0));
//imageAttr.SetColorKey(Color.Blue,Color.Blue);
// Draw the image with the color key set.
System.Drawing.Rectangle rect;
try
{
rect = new Rectangle(0, 0, this.m_bmp.Width, this.m_bmp.Height);
e.Graphics.DrawImage(m_bmp, // Image
rect, // Dest. rect.
0, // srcX
0, // srcY
this.m_bmp.Width, // srcWidth
this.m_bmp.Height, // srcHeight
GraphicsUnit.Pixel, // srcUnit
imageAttr); // ImageAttributes
}
catch(Exception ex){}

thanks in advance

Re: Gif image transparent by Chris

Chris
Wed Jun 08 15:39:48 CDT 2005

I suggest searching the newsgroup archive for the answer to this FAQ item:

http://tinyurl.com/7f8pd

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate


"jeff" <jeff@discussions.microsoft.com> wrote in message
news:F75004FF-7236-406B-97F5-7916019744A1@microsoft.com...
> hi,All
>
> I have a gif image(done by photoshop, and the background is transparent)
> I want to draw it on my forms.
> But the background is not transparent.
>
> How to do it?
>
> I try source below:but it does not work?
>
> ImageAttributes imageAttr = new ImageAttributes();
> imageAttr.SetColorKey(Color.FromArgb(0,255,0),Color.FromArgb(0,255,0));
> //imageAttr.SetColorKey(Color.Blue,Color.Blue);
> // Draw the image with the color key set.
> System.Drawing.Rectangle rect;
> try
> {
> rect = new Rectangle(0, 0, this.m_bmp.Width, this.m_bmp.Height);
> e.Graphics.DrawImage(m_bmp, // Image
> rect, // Dest. rect.
> 0, // srcX
> 0, // srcY
> this.m_bmp.Width, // srcWidth
> this.m_bmp.Height, // srcHeight
> GraphicsUnit.Pixel, // srcUnit
> imageAttr); // ImageAttributes
> }
> catch(Exception ex){}
>
> thanks in advance
>
>
>
>
>



RE: Gif image transparent by a

a
Wed Jun 08 15:43:02 CDT 2005

Windows CE doesn't support transparent images, so usually the transparent
color becomes white or black. You can try identify it by getting a pixel from
the top left corner.

Color transpColor = m_bmp.GetPixel(0, 0);

--
Alex Yakhnin, .NET CF MVP
www.intelliprog.com | www.opennetcf.org


"jeff" wrote:

> hi,All
>
> I have a gif image(done by photoshop, and the background is transparent)
> I want to draw it on my forms.
> But the background is not transparent.
>
> How to do it?
>
> I try source below:but it does not work?
>
> ImageAttributes imageAttr = new ImageAttributes();
> imageAttr.SetColorKey(Color.FromArgb(0,255,0),Color.FromArgb(0,255,0));
> //imageAttr.SetColorKey(Color.Blue,Color.Blue);
> // Draw the image with the color key set.
> System.Drawing.Rectangle rect;
> try
> {
> rect = new Rectangle(0, 0, this.m_bmp.Width, this.m_bmp.Height);
> e.Graphics.DrawImage(m_bmp, // Image
> rect, // Dest. rect.
> 0, // srcX
> 0, // srcY
> this.m_bmp.Width, // srcWidth
> this.m_bmp.Height, // srcHeight
> GraphicsUnit.Pixel, // srcUnit
> imageAttr); // ImageAttributes
> }
> catch(Exception ex){}
>
> thanks in advance
>
>
>
>
>

Re: Gif image transparent by jeff

jeff
Wed Jun 08 18:09:02 CDT 2005

Thanks, I got it work from discussion

"Chris Tacke, eMVP" wrote:

> I suggest searching the newsgroup archive for the answer to this FAQ item:
>
> http://tinyurl.com/7f8pd
>
> --
> Chris Tacke
> Co-founder
> OpenNETCF.org
> Has OpenNETCF helped you? Consider donating to support us!
> http://www.opennetcf.org/donate
>
>
> "jeff" <jeff@discussions.microsoft.com> wrote in message
> news:F75004FF-7236-406B-97F5-7916019744A1@microsoft.com...
> > hi,All
> >
> > I have a gif image(done by photoshop, and the background is transparent)
> > I want to draw it on my forms.
> > But the background is not transparent.
> >
> > How to do it?
> >
> > I try source below:but it does not work?
> >
> > ImageAttributes imageAttr = new ImageAttributes();
> > imageAttr.SetColorKey(Color.FromArgb(0,255,0),Color.FromArgb(0,255,0));
> > //imageAttr.SetColorKey(Color.Blue,Color.Blue);
> > // Draw the image with the color key set.
> > System.Drawing.Rectangle rect;
> > try
> > {
> > rect = new Rectangle(0, 0, this.m_bmp.Width, this.m_bmp.Height);
> > e.Graphics.DrawImage(m_bmp, // Image
> > rect, // Dest. rect.
> > 0, // srcX
> > 0, // srcY
> > this.m_bmp.Width, // srcWidth
> > this.m_bmp.Height, // srcHeight
> > GraphicsUnit.Pixel, // srcUnit
> > imageAttr); // ImageAttributes
> > }
> > catch(Exception ex){}
> >
> > thanks in advance
> >
> >
> >
> >
> >
>
>
>