Transparent image

P

Peder Y

1) I'm drawing an image on a Graphics object. Is there a good way to
change a full picture's opacity without iterating through all the
pixels and setting a new alpha value? This will be used to make the
picture fade out.

2) I have a semitransparent LinkLabel. This label will also contain a
picture that needs to fade out. However, as the text gradually fades
out, the picture lingers. How is this done?

Thanks!

- Peder -
 
P

Peter Morris [Droopy eyes software]

Here is some of my code, parts ommitted....

System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Width, Height,
PixelFormat.Format32bppArgb);
System.Drawing.Graphics gfx = System.Drawing.Graphics.FromImage(bmp);
PaintEventArgs temppe = new PaintEventArgs(gfx, r);
if (1 != Opacity)
{
ColorMatrix cm = new ColorMatrix();
cm.Matrix33 = (float)Opacity;
ImageAttributes ia = new ImageAttributes();
ia.SetColorMatrix(cm, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
pe.Graphics.DrawImage(bmp, new Rectangle(0, 0, Width, Height), 0, 0,
Width, Height, GraphicsUnit.Pixel, ia);
}
else
pe.Graphics.DrawImage(bmp, 0, 0);


--
Pete
-------
http://www.DroopyEyes.com
Audio compression components, DIB Controls, FastStrings

http://www.HowToDoThings.com
Read or write articles on just about anything
 

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