asked on
private void button1_MouseDown(object sender, MouseEventArgs e)
{
Button btn = sender as Button;
using (Bitmap bmp = new Bitmap(btn.Width, btn.Height))
{
btn.DrawToBitmap(bmp, new Rectangle(Point.Empty, btn.Size));
using (Graphics gfx = Graphics.FromImage(bmp))
{
ColorMatrix matrix = new ColorMatrix();
matrix.Matrix33 = .5F;
ImageAttributes attributes = new ImageAttributes();
attributes.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
gfx.DrawImage(bmp, new Rectangle(Point.Empty, bmp.Size));
Cursor cur = new Cursor(bmp.GetHicon());
Cursor.Current = cur;
}
}
}
It's supposed to draw the image with transparency but it's opaque. How do I add alpha channel info? My ultimate goal is to have an alpha channel gradient so the transparency increases as the image gets further away from a given point (usually the center or the left edge).
ASKER
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
TRUSTED BY
ASKER