本文介绍了我可以使用这些代码将图形制作成图像吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public void drawPoint(int x,int y,SolidBrush brush)

{

Graphics g = Graphics.FromHwnd(pictureBox1.Handle);

Point dPoint = new Point(x,(pictureBox1.Height - y));

dPoint.X = dPoint.X - 2;

dPoint.Y = dPoint.Y - 2;

Rectangle rect = new Rectangle(dPoint,new Size(5,5));

g.FillRectangle(brush,rect);

g.Dispose();



}



int a = 0;

int b = 0;



private void pictureBox1_Paint(object sender,System.Windows.Forms.PaintEventArgs e)

{

使用(Graphics graphic = pictureBox1.CreateGraphics())

{

graphic.DrawImage(pictureBox1.Image,e。 ClipRectangle,a,b,e.ClipRectangle.Width,

e。 ClipRectangle.Height,GraphicsUnit.Pixel);

//e.Graphics.DrawImage(pictureBox1.Image,e.ClipRectangle,a,b,e.ClipRectangle.Width,e.ClipRectangle.Height,GraphicsUnit .Pixel);

}

}

public void drawPoint(int x, int y, SolidBrush brush)
{
Graphics g = Graphics.FromHwnd(pictureBox1.Handle);
Point dPoint = new Point(x, (pictureBox1.Height - y));
dPoint.X = dPoint.X - 2;
dPoint.Y = dPoint.Y - 2;
Rectangle rect = new Rectangle(dPoint, new Size(5, 5));
g.FillRectangle(brush, rect);
g.Dispose();

}

int a = 0;
int b = 0;

private void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
using (Graphics graphic = pictureBox1.CreateGraphics())
{
graphic.DrawImage(pictureBox1.Image, e.ClipRectangle, a, b, e.ClipRectangle.Width,
e.ClipRectangle.Height, GraphicsUnit.Pixel);
//e.Graphics.DrawImage(pictureBox1.Image, e.ClipRectangle, a, b, e.ClipRectangle.Width,e.ClipRectangle.Height, GraphicsUnit.Pixel);
}
}

推荐答案


这篇关于我可以使用这些代码将图形制作成图像吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 08:55