我想允许用户在汽车的损坏部位上打上标记,然后保存新图像。我找到了解决方案:
protected void ImageMap1_Click1(object sender, ImageMapEventArgs args)
{
int x = Cursor.Position.X;
int y = Cursor.Position.Y;
Bitmap bitMapIm = new System.Drawing.Bitmap(Server.MapPath("~/Images/car.jpg"));
Graphics graphicIm = Graphics.FromImage(bitMapIm);
Pen penRed = new Pen(Color.Red, 3);
SolidBrush sp= new SolidBrush(Color.Red);
//graphicIm.DrawString("X", new Font("Arial", 25, FontStyle.Bold), Brushes.Red, x, y);
//Rectangle rect = new Rectangle(x, y, 200, 200);
//graphicIm.DrawRectangle(penRed, rect);
graphicIm.FillEllipse(sp, x, y, 25, 25);
bitMapIm.Save(Server.MapPath("~/Images/car1.jpg"), ImageFormat.Jpeg);
graphicIm.Dispose();
bitMapIm.Dispose();
ImageMap1.ImageUrl = "~/Images/car1.jpg";
}
但是这会在我每次标记时将图像另存为新图像吗?
如何使它成为一个简单的图像编辑器,用户可以在其上标记并保存图像?