Bitmap _NewBitmap = new Bitmap(dataGridView1.Width, dataGridView1.Height);
#region
// 为NewBitmap 赋值
#endregion
pictureBox1.Image = myAlpha(_NewBitmap);
pictureBox1.Image.Save(@"c:\1.png");
private Bitmap myAlpha(Bitmap _Bitmap)
{
Graphics _Graphcis = Graphics.FromImage(_Bitmap);
Point _Left1 = new Point(0, 0);
Point _Left2 = new Point(_Bitmap.Width, 0);
Point _Left3 = new Point(_Bitmap.Width, _Bitmap.Height / 2);
Point _Left4 = new Point(0, _Bitmap.Height / 2);
Point[] _Point = new Point[] { _Left1, _Left2, _Left3, _Left4 };
PathGradientBrush _SetBruhs = new PathGradientBrush(_Point, WrapMode.TileFlipY);
_SetBruhs.CenterPoint = new PointF(0, 0);
_SetBruhs.FocusScales = new PointF(_Bitmap.Width / 2, 0);
_SetBruhs.CenterColor = Color.FromArgb(255, 255, 255, 255);
_SetBruhs.SurroundColors = new Color[] { Color.FromArgb(0, 255, 255, 255) };
_Graphcis.FillRectangle(_SetBruhs, new Rectangle(0, 0, _Bitmap.Width, _Bitmap.Height));
return _Bitmap;
}
我把加入alpha的图像放入到pictureBox中,也没有出现透明。没分了,实在抱歉