62,050
社区成员
发帖
与我相关
我的任务
分享
// Create panel
Bitmap bitImage = new Bitmap( 200, 200 );
// Create graphics
Graphics newGraphics = Graphics.FromImage((System.Drawing.Image)bitImage);
// Draw image
Pen p = new Pen(Color.Blue, 2);//定义了一个蓝色,宽度为的画笔
newGraphics.DrawLine(p, 10, 10, 100, 100);//在画板上画直线,起始坐标为(10,10),终点坐标为(100,100)
// Save image
string strTempFileName = Server.MapPath( "Images" ) + "/ImgTemp.jpg";
bitImage.Save( strTempFileName );
// Draw image to screen.
imgTest.ImageUrl = @"Images/ImgTemp.jpg";
// Release graphics object.
newGraphics.Dispose();
bitImage.Dispose();