C# 使用Graphics对象在程序运行时创建位图
代码说明:
C# 在程序运行时创建位图,本源码实例主要是学习使用使用Graphics对象创建简单图像的例子,本程序将生成一条曲线图像,参照如下代码: {//在程序运行时创建位图 int MyWidth=this.pictureBox1.Width; int MyHeight=this.pictureBox1.Height; Bitmap MyBitmap = new Bitmap(MyWidth,MyHeight); Graphics MyGraphics = Graphics.FromImage(MyBitmap); Pen MyPen = new Pen(Color.Black, 3); Point[] MyPoints = { new Point(50, 100), new Point(100, 10), new Point(150, 290), new Point(200, 100), new Point(250, 10), new Point(300, 290), new Point(350, 100) }; MyGraphics.Clear(Color.White); MyGraphics.DrawBeziers(MyPen, MyPoints); pictureBox1.Image = MyBitmap;
下载说明:请别用迅雷下载,失败请重下,重下不扣分!