本文整理汇总了C#中System.Drawing.Drawing2D.PathGradientBrush类的典型用法代码示例。如果您正苦于以下问题:C# PathGradientBrush类的具体用法?C# PathGradientBrush怎么用?C# PathGradientBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathGradientBrush类属于System.Drawing.Drawing2D命名空间,在下文中一共展示了PathGradientBrush类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderEllipseGlass
public static void RenderEllipseGlass(Graphics g, Rectangle ownerRect, GlassPosition position,
float positionFactor, Color glassColor, int alphaCenter, int alphaSurround)
{
if (!(positionFactor > 0 && positionFactor < 1))
throw new ArgumentException("positionFactor must be between 0 and 1, but not include 0 and 1. ",
"positionFactor");
ownerRect.Height--;
ownerRect.Width--;
if (ownerRect.Width < 1 || ownerRect.Height < 1)
return;
using (GraphicsPath gp = new GraphicsPath())
{
gp.AddEllipse(ownerRect);
using (PathGradientBrush pb = new PathGradientBrush(gp))
{
pb.CenterPoint = GetEllipseGlassCenterPoint(ownerRect, position, positionFactor);
pb.CenterColor = Color.FromArgb(alphaCenter, glassColor);
pb.SurroundColors = new Color[] { Color.FromArgb(alphaSurround, glassColor) };
using (NewSmoothModeGraphics ng = new NewSmoothModeGraphics(g, SmoothingMode.AntiAlias))
{
g.FillPath(pb, gp);
}
}
}
}
示例2: Form1_Paint
private void Form1_Paint(object sender, PaintEventArgs e)
{
using (Graphics g = e.Graphics)
{
// Создаем траекторию
GraphicsPath path = new GraphicsPath();
Rectangle rect = new Rectangle(20, 20, 150, 150);
path.AddRectangle(rect);
// Создаем градиентную кисть
PathGradientBrush pgBrush =
new PathGradientBrush(path.PathPoints);
// Уснинавливаем цвета кисти
pgBrush.CenterColor = Color.Red;
pgBrush.SurroundColors = new Color[] { Color.Blue };
// Создаем объект Matrix
Matrix X = new Matrix();
// Translate
X.Translate(30.0f, 10.0f, MatrixOrder.Append);
// Rotate
X.Rotate(10.0f, MatrixOrder.Append);
// Scale
X.Scale(1.2f, 1.0f, MatrixOrder.Append);
// Shear
X.Shear(.2f, 0.03f, MatrixOrder.Prepend);
// Применяем преобразование к траектории и кисти
path.Transform(X);
pgBrush.Transform = X;
// Выполняем визуализацию
g.FillPath(pgBrush, path);
}
}
示例3: Paint
public void Paint(PaintEventArgs e)
{
Graphics g = e.Graphics;
rect = new Rectangle(x, y, width, height);
Point[] pt =
{
new Point(rect.X,rect.Y),
new Point(rect.X+rect.Width,rect.Y),
new Point(rect.X+rect.Width,rect.Y+rect.Height),
new Point(rect.X,rect.Y+rect.Height)
};
PathGradientBrush pth = new PathGradientBrush(pt);
pth.SurroundColors = new Color[]
{
Color.FromArgb(10,R,G,B)
};
g.DrawLine(new Pen(Color.FromArgb(255, R, G, B), 2), new Point(rect.X, rect.Y), new Point(rect.X, rect.Y + rect.Height));
g.DrawLine(new Pen(Color.FromArgb(255, R, G, B), 2), new Point(rect.X + rect.Width / 10, rect.Y), new Point(rect.X + rect.Width / 10, rect.Y + rect.Height));
g.DrawLine(new Pen(Color.FromArgb(255, R, G, B), 2), new Point(rect.X, rect.Y), new Point(rect.X + (rect.Width / 10), rect.Y));
g.DrawLine(new Pen(Color.FromArgb(255, R, G, B), 2), new Point(rect.X + (rect.Width - rect.Width / 10), rect.Y), new Point(rect.X + rect.Width, rect.Y));
g.DrawLine(new Pen(Color.FromArgb(255, R, G, B), 2), new Point(rect.X + (rect.Width - rect.Width / 10), rect.Y), new Point(rect.X + (rect.Width - rect.Width / 10), rect.Y + rect.Height));
g.DrawLine(new Pen(Color.FromArgb(255, R, G, B), 2), new Point(rect.X + rect.Width / 3, rect.Y + 3), new Point(rect.X + rect.Width / 3, rect.Y + rect.Height));
g.DrawLine(new Pen(Color.FromArgb(255, R, G, B), 2), new Point(rect.X + (rect.Width / 3) * 2, rect.Y + 3), new Point(rect.X + (rect.Width / 3) * 2, rect.Y + rect.Height));
g.DrawLine(new Pen(Color.FromArgb(255, R, G, B), 2), new Point(rect.X + rect.Width, rect.Y), new Point(rect.X + rect.Width, rect.Y + rect.Height));
pth.CenterColor = Color.FromArgb(A, R, G, B);
g.FillRectangle(pth, rect);
}
示例4: OnPaintBackground
protected override void OnPaintBackground(PaintEventArgs pevent)
{
base.OnPaintBackground(pevent);
pevent.Graphics.Clear(Color.FromArgb(0));
foreach (TabPage tab in this.TabPages)
{
Rectangle tabRect = GetTabRect(this.TabPages.IndexOf(tab));
using (StringFormat sf = new StringFormat(StringFormatFlags.NoWrap))
{
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
SizeF textSize = pevent.Graphics.MeasureString(tab.Text, this.Font);
RectangleF rc = new RectangleF(tabRect.Left + ((tabRect.Width / 2) - (textSize.Width / 2)), tabRect.Top + tabRect.Height / 2 - textSize.Height / 2, textSize.Width, textSize.Height);
rc.Inflate(4, 5);
GraphicsPath path = new GraphicsPath();
path.AddRectangle(rc);
using (PathGradientBrush brush = new PathGradientBrush(path))
{
brush.CenterColor = Color.FromArgb(192, tab == this.SelectedTab ? Color.Red : Color.Black);
brush.SurroundColors = new Color[] { Color.Black };
pevent.Graphics.FillRectangle(brush,rc);
}
var tc = new SolidBrush(Color.FromArgb(tab.ForeColor.A, tab.ForeColor.R, tab.ForeColor.G, tab.ForeColor.B));
pevent.Graphics.DrawString(tab.Text, this.Font, tc, rc, sf);
}
}
}
示例5: DrawBreakpoint
/// <summary>
/// Draws a breakpoint icon in the margin.
/// </summary>
/// <param name="g">The <see cref="Graphics"/> context.</param>
/// <param name="rectangle">The bounding rectangle.</param>
/// <param name="isEnabled"><c>true</c> if enabled..</param>
/// <param name="willBeHit"><c>true</c> if it will be hit.</param>
public static void DrawBreakpoint(Graphics g, Rectangle rectangle, bool isEnabled, bool willBeHit)
{
int diameter = Math.Min(rectangle.Width - 4, rectangle.Height);
Rectangle rect = new Rectangle(2, rectangle.Y + (rectangle.Height - diameter) / 2, diameter, diameter);
using (GraphicsPath path = new GraphicsPath())
{
path.AddEllipse(rect);
using (PathGradientBrush pthGrBrush = new PathGradientBrush(path))
{
pthGrBrush.CenterPoint = new PointF(rect.Left + rect.Width / 3, rect.Top + rect.Height / 3);
pthGrBrush.CenterColor = Color.MistyRose;
Color[] colors = { willBeHit ? Color.Firebrick : Color.Olive };
pthGrBrush.SurroundColors = colors;
if (isEnabled)
{
g.FillEllipse(pthGrBrush, rect);
}
else
{
g.FillEllipse(SystemBrushes.Control, rect);
using (Pen pen = new Pen(pthGrBrush))
{
g.DrawEllipse(pen, new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2));
}
}
}
}
}
示例6: RenderFrameByCenter
protected override void RenderFrameByCenter(PaintEventArgs e, Rectangle r)
{
Graphics g = e.Graphics;
using (GraphicsPath path = new GraphicsPath())
{
path.AddRectangle(GaugeFrame.Bounds);
using (PathGradientBrush br = new PathGradientBrush(path))
{
br.CenterPoint = GaugeFrame.Center;
br.CenterColor = GaugeFrame.FrameColor.Start;
br.SurroundColors = new Color[] { GaugeFrame.FrameColor.End };
br.SetSigmaBellShape(GaugeFrame.FrameSigmaFocus, GaugeFrame.FrameSigmaScale);
g.FillRectangle(br, GaugeFrame.Bounds);
}
path.AddRectangle(r);
using (PathGradientBrush br = new PathGradientBrush(path))
{
br.CenterPoint = GaugeFrame.Center;
br.CenterColor = GaugeFrame.FrameColor.End;
br.SurroundColors = new Color[] { GaugeFrame.FrameColor.Start };
g.FillRectangle(br, r);
}
}
RenderFrameBorder(g, GaugeFrame.Bounds);
}
示例7: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
using (SolidBrush b = new SolidBrush(BackColor))
{
e.Graphics.FillRectangle(b, ClientRectangle);
}
RectangleF wheelrect = WheelRectangle;
Util.DrawFrame(e.Graphics, wheelrect, 6, m_frameColor);
wheelrect = ColorWheelRectangle;
PointF center = Util.Center(wheelrect);
e.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
if (m_brush == null)
{
m_brush = new PathGradientBrush(m_path.ToArray(), WrapMode.Clamp);
m_brush.CenterPoint = center;
m_brush.CenterColor = Color.White;
m_brush.SurroundColors = m_colors.ToArray();
}
e.Graphics.FillPie(m_brush, Util.Rect(wheelrect), 0, 360);
DrawColorSelector(e.Graphics);
if (Focused)
{
RectangleF r = WheelRectangle;
r.Inflate(-2,-2);
ControlPaint.DrawFocusRectangle(e.Graphics, Util.Rect(r));
}
}
示例8: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Rectangle rect = ClientRectangle;
if (Dock == DockStyle.Left || Dock == DockStyle.Right)
{
using (GraphicsPath path = new GraphicsPath())
{
path.AddRectangle(rect);
using (PathGradientBrush brush = new PathGradientBrush(path) { CenterColor = Color.FromArgb(0xFF, 204, 206, 219), SurroundColors = new[] { SystemColors.Control } })
{
e.Graphics.FillRectangle(brush, rect.X + Measures.SplitterSize / 2 - 1, rect.Y,
Measures.SplitterSize / 3, rect.Height);
}
}
}
else
{
if (Dock == DockStyle.Top || Dock == DockStyle.Bottom)
{
using (SolidBrush brush = new SolidBrush(Color.FromArgb(0xFF, 204, 206, 219)))
{
e.Graphics.FillRectangle(brush, rect.X, rect.Y,
rect.Width, Measures.SplitterSize);
}
}
}
}
示例9: PaintVignette
public static void PaintVignette(Graphics g, Rectangle bounds)
{
Rectangle ellipsebounds = bounds;
ellipsebounds.Offset(-ellipsebounds.X, -ellipsebounds.Y);
int x = ellipsebounds.Width - (int)Math.Round(.70712 * ellipsebounds.Width);
int y = ellipsebounds.Height - (int)Math.Round(.70712 * ellipsebounds.Height);
ellipsebounds.Inflate(x, y);
using (GraphicsPath path = new GraphicsPath())
{
path.AddEllipse(ellipsebounds);
using (PathGradientBrush brush = new PathGradientBrush(path))
{
brush.WrapMode = WrapMode.Tile;
brush.CenterColor = Color.FromArgb(0, 0, 0, 0);
brush.SurroundColors = new Color[] { Color.FromArgb(255, 0, 0, 0) };
Blend blend = new Blend();
blend.Positions = new float[] { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0F };
blend.Factors = new float[] { 0.0f, 0.5f, 1f, 1f, 1.0f, 1.0f };
brush.Blend = blend;
Region oldClip = g.Clip;
g.Clip = new Region(bounds);
g.FillRectangle(brush, ellipsebounds);
g.Clip = oldClip;
}
}
}
示例10: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics G = e.Graphics;
LinearGradientBrush linearGradientBrush1 = new LinearGradientBrush(//创建线性渐变画刷
new Point(0, 0),new Point(20, 20), //渐变起始点和终止点
Color.Yellow,Color.Blue); //渐变起始颜色和终止颜色
G.FillRectangle(linearGradientBrush1, new Rectangle(0, 0, 150, 150));//绘制矩形
LinearGradientBrush linearGradientBrush2 = new LinearGradientBrush(//创建线性渐变画刷
new Rectangle(0, 0, 20, 20), //渐变所在矩形
Color.Yellow, Color.Blue, 60f); //渐变起始颜色、终止颜色以及渐变方向
linearGradientBrush2.WrapMode = WrapMode.TileFlipXY;
G.FillRectangle(linearGradientBrush2, new Rectangle(150, 0, 150, 150));//绘制矩形
GraphicsPath graphicsPath1 = new GraphicsPath(); //创建绘制路径
graphicsPath1.AddArc(new Rectangle(0, 150, 100, 100), 90, 180);//向路径中添加半左圆弧
graphicsPath1.AddArc(new Rectangle(150, 150, 100, 100), 270, 180);//向路径中添加半右圆弧
graphicsPath1.CloseFigure(); //闭合路径
PathGradientBrush pathGradientBrush = new PathGradientBrush(graphicsPath1);//创建路径渐变画刷
pathGradientBrush.CenterColor = Color.Yellow; //指定画刷中心颜色
pathGradientBrush.SurroundColors = new Color[] { Color.Blue };//指定画刷周边颜色
pathGradientBrush.CenterPoint = new PointF(125, 200); //指定画刷中心点坐标
G.SmoothingMode = SmoothingMode.AntiAlias; //消锯齿
G.FillPath(pathGradientBrush, graphicsPath1); //利用画刷填充路径
G.DrawPath(new Pen(Color.Lime, 3f), graphicsPath1); //绘制闭合路径曲线
linearGradientBrush1.Dispose();
linearGradientBrush2.Dispose();
graphicsPath1.Dispose();
pathGradientBrush.Dispose();
}
示例11: GetBrush
public static System.Drawing.Brush GetBrush(this Brush brush, Rect frame)
{
var cb = brush as SolidBrush;
if (cb != null) {
return new System.Drawing.SolidBrush (cb.Color.GetColor ());
}
var lgb = brush as LinearGradientBrush;
if (lgb != null) {
var s = lgb.Absolute ? lgb.Start : frame.Position + lgb.Start * frame.Size;
var e = lgb.Absolute ? lgb.End : frame.Position + lgb.End * frame.Size;
var b = new System.Drawing.Drawing2D.LinearGradientBrush (GetPointF (s), GetPointF (e), System.Drawing.Color.Black, System.Drawing.Color.Black);
var bb = BuildBlend (lgb.Stops);
if (bb != null) {
b.InterpolationColors = bb;
}
return b;
}
var rgb = brush as RadialGradientBrush;
if (rgb != null) {
var r = rgb.GetAbsoluteRadius (frame);
var c = rgb.GetAbsoluteCenter (frame);
var path = new GraphicsPath ();
path.AddEllipse (GetRectangleF (new Rect (c - r, 2 * r)));
var b = new PathGradientBrush (path);
var bb = BuildBlend (rgb.Stops, true);
if (bb != null) {
b.InterpolationColors = bb;
}
return b;
}
throw new NotImplementedException ("Brush " + brush);
}
示例12: CreateGradientPalette
private Color[] CreateGradientPalette()
{
Bitmap b = new Bitmap(100, 1);
var g = Graphics.FromImage(b);
Point[] points = { new Point(0, 0), new Point(50, 0), new Point(100, 0), new Point(100, 1) };
Color[] colors = { Color.Red, Color.Yellow, Color.Green };
//GraphicsPath path = new GraphicsPath();
//path.AddLines(points);
// Use the path to construct a path gradient brush.
PathGradientBrush br = new PathGradientBrush(points);
br.SurroundColors = colors;
// var br = new LinearGradientBrush(new Point(0, 0), new Point(100, 0), Color.Red, Color.Green);
g.FillRectangle(br, 0, 0, 100, 1);
Color[] palette = new Color[b.Size.Width];
for (int i = 0; i < palette.Length; i++)
{
palette[i] = b.GetPixel(i, 0);
}
b.Dispose();
return palette;
}
示例13: DrawButton
protected virtual void DrawButton(Graphics g, Rectangle buttonRect)
{
this.BuildGraphicsPath(buttonRect);
PathGradientBrush brush = new PathGradientBrush(this.bpath);
brush.SurroundColors = new Color[] { this.buttonColor };
buttonRect.Offset(this.buttonPressOffset, this.buttonPressOffset);
if (this.bevelHeight > 0)
{
buttonRect.Inflate(1, 1);
brush.CenterPoint = new PointF((float) ((buttonRect.X + (buttonRect.Width / 8)) + this.buttonPressOffset), (float) ((buttonRect.Y + (buttonRect.Height / 8)) + this.buttonPressOffset));
brush.CenterColor = this.cColor;
this.FillShape(g, brush, buttonRect);
this.ShrinkShape(ref g, ref buttonRect, this.bevelHeight);
}
if (this.bevelDepth > 0)
{
this.DrawInnerBevel(g, buttonRect, this.bevelDepth, this.buttonColor);
this.ShrinkShape(ref g, ref buttonRect, this.bevelDepth);
}
brush.CenterColor = this.buttonColor;
if (this.dome)
{
brush.CenterColor = this.cColor;
brush.CenterPoint = new PointF((float) ((buttonRect.X + (buttonRect.Width / 8)) + this.buttonPressOffset), (float) ((buttonRect.Y + (buttonRect.Height / 8)) + this.buttonPressOffset));
}
this.FillShape(g, brush, buttonRect);
if (this.gotFocus)
{
this.DrawFocus(g, buttonRect);
}
}
示例14: BothAlpha
public static Bitmap BothAlpha(Bitmap p_Bitmap, bool p_CentralTransparent, bool p_Crossdirection)
{
Bitmap image = new Bitmap(p_Bitmap.Width, p_Bitmap.Height);
Graphics graphics = Graphics.FromImage(image);
graphics.DrawImage(p_Bitmap, new Rectangle(0, 0, p_Bitmap.Width, p_Bitmap.Height));
graphics.Dispose();
Bitmap bitmap2 = new Bitmap(image.Width, image.Height);
Graphics graphics2 = Graphics.FromImage(bitmap2);
System.Drawing.Point point = new System.Drawing.Point(0, 0);
System.Drawing.Point point2 = new System.Drawing.Point(bitmap2.Width, 0);
System.Drawing.Point point3 = new System.Drawing.Point(bitmap2.Width, bitmap2.Height / 2);
System.Drawing.Point point4 = new System.Drawing.Point(0, bitmap2.Height / 2);
if (p_Crossdirection)
{
point = new System.Drawing.Point(0, 0);
point2 = new System.Drawing.Point(bitmap2.Width / 2, 0);
point3 = new System.Drawing.Point(bitmap2.Width / 2, bitmap2.Height);
point4 = new System.Drawing.Point(0, bitmap2.Height);
}
System.Drawing.Point[] points = new System.Drawing.Point[] { point, point2, point3, point4 };
PathGradientBrush brush = new PathGradientBrush(points, WrapMode.TileFlipY) {
CenterPoint = new PointF(0f, 0f),
FocusScales = new PointF((float) (bitmap2.Width / 2), 0f),
CenterColor = Color.FromArgb(0, 0xff, 0xff, 0xff)
};
brush.SurroundColors = new Color[] { Color.FromArgb(0xff, 0xff, 0xff, 0xff) };
if (p_Crossdirection)
{
brush.FocusScales = new PointF(0f, (float) bitmap2.Height);
brush.WrapMode = WrapMode.TileFlipX;
}
if (p_CentralTransparent)
{
brush.CenterColor = Color.FromArgb(0xff, 0xff, 0xff, 0xff);
brush.SurroundColors = new Color[] { Color.FromArgb(0, 0xff, 0xff, 0xff) };
}
graphics2.FillRectangle(brush, new Rectangle(0, 0, bitmap2.Width, bitmap2.Height));
graphics2.Dispose();
BitmapData bitmapdata = bitmap2.LockBits(new Rectangle(0, 0, bitmap2.Width, bitmap2.Height), ImageLockMode.ReadOnly, bitmap2.PixelFormat);
byte[] destination = new byte[bitmapdata.Stride * bitmapdata.Height];
Marshal.Copy(bitmapdata.Scan0, destination, 0, destination.Length);
bitmap2.UnlockBits(bitmapdata);
BitmapData data2 = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadWrite, image.PixelFormat);
byte[] buffer2 = new byte[data2.Stride * data2.Height];
Marshal.Copy(data2.Scan0, buffer2, 0, buffer2.Length);
int index = 0;
for (int i = 0; i != data2.Height; i++)
{
index = (i * data2.Stride) + 3;
for (int j = 0; j != data2.Width; j++)
{
buffer2[index] = destination[index];
index += 4;
}
}
Marshal.Copy(buffer2, 0, data2.Scan0, buffer2.Length);
image.UnlockBits(data2);
return image;
}
示例15: BothAlpha
public static Bitmap BothAlpha(Bitmap p_Bitmap, bool p_CentralTransparent, bool p_Crossdirection)
{
Bitmap _SetBitmap = new Bitmap(p_Bitmap.Width, p_Bitmap.Height);
Graphics _GraphisSetBitmap = Graphics.FromImage(_SetBitmap);
_GraphisSetBitmap.DrawImage(p_Bitmap, new Rectangle(0, 0, p_Bitmap.Width, p_Bitmap.Height));
_GraphisSetBitmap.Dispose();
Bitmap _Bitmap = new Bitmap(_SetBitmap.Width, _SetBitmap.Height);
Graphics _Graphcis = Graphics.FromImage(_Bitmap);
System.Drawing.Point _Left1 = new System.Drawing.Point(0, 0);
System.Drawing.Point _Left2 = new System.Drawing.Point(_Bitmap.Width, 0);
System.Drawing.Point _Left3 = new System.Drawing.Point(_Bitmap.Width, _Bitmap.Height / 2);
System.Drawing.Point _Left4 = new System.Drawing.Point(0, _Bitmap.Height / 2);
if (p_Crossdirection)
{
_Left1 = new System.Drawing.Point(0, 0);
_Left2 = new System.Drawing.Point(_Bitmap.Width / 2, 0);
_Left3 = new System.Drawing.Point(_Bitmap.Width / 2, _Bitmap.Height);
_Left4 = new System.Drawing.Point(0, _Bitmap.Height);
}
System.Drawing.Point[] _Point = new System.Drawing.Point[] { _Left1, _Left2, _Left3, _Left4 };
PathGradientBrush _SetBruhs = new PathGradientBrush(_Point, WrapMode.TileFlipY);
_SetBruhs.CenterPoint = new PointF(0f, 0f);
_SetBruhs.FocusScales = new PointF((float) (_Bitmap.Width / 2), 0f);
_SetBruhs.CenterColor = Color.FromArgb(0, 0xff, 0xff, 0xff);
_SetBruhs.SurroundColors = new Color[] { Color.FromArgb(0xff, 0xff, 0xff, 0xff) };
if (p_Crossdirection)
{
_SetBruhs.FocusScales = new PointF(0f, (float) _Bitmap.Height);
_SetBruhs.WrapMode = WrapMode.TileFlipX;
}
if (p_CentralTransparent)
{
_SetBruhs.CenterColor = Color.FromArgb(0xff, 0xff, 0xff, 0xff);
_SetBruhs.SurroundColors = new Color[] { Color.FromArgb(0, 0xff, 0xff, 0xff) };
}
_Graphcis.FillRectangle(_SetBruhs, new Rectangle(0, 0, _Bitmap.Width, _Bitmap.Height));
_Graphcis.Dispose();
BitmapData _NewData = _Bitmap.LockBits(new Rectangle(0, 0, _Bitmap.Width, _Bitmap.Height), ImageLockMode.ReadOnly, _Bitmap.PixelFormat);
byte[] _NewBytes = new byte[_NewData.Stride * _NewData.Height];
Marshal.Copy(_NewData.Scan0, _NewBytes, 0, _NewBytes.Length);
_Bitmap.UnlockBits(_NewData);
BitmapData _SetData = _SetBitmap.LockBits(new Rectangle(0, 0, _SetBitmap.Width, _SetBitmap.Height), ImageLockMode.ReadWrite, _SetBitmap.PixelFormat);
byte[] _SetBytes = new byte[_SetData.Stride * _SetData.Height];
Marshal.Copy(_SetData.Scan0, _SetBytes, 0, _SetBytes.Length);
int _WriteIndex = 0;
for (int i = 0; i != _SetData.Height; i++)
{
_WriteIndex = (i * _SetData.Stride) + 3;
for (int z = 0; z != _SetData.Width; z++)
{
_SetBytes[_WriteIndex] = _NewBytes[_WriteIndex];
_WriteIndex += 4;
}
}
Marshal.Copy(_SetBytes, 0, _SetData.Scan0, _SetBytes.Length);
_SetBitmap.UnlockBits(_SetData);
return _SetBitmap;
}