在图像上画线或插入十字标记并保存图像 [英] draw line or insert crossmark on image and save the image
本文介绍了在图像上画线或插入十字标记并保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
am在C#中进行编码
页面上有容器图像
现在执行后,我必须能够在该图像上打上十字标记(以显示损坏)
或绘制十字标记,就像我们用画笔在油漆中绘制一样
之后,我必须能够将更改后的图像保存在数据库中
请帮助
提前tnX
am doing coding in C#
am having an container image on the page
now after executing i must able to put crossmark on that image(to show the damages)
or draw cross mark like we draw in paint with paint brush
and after that i must able to save the changed image in database
plz help
tnX in advance
推荐答案
假设您使用的是PictureBox或类似的容器,然后在上面绘制一个十字就很容易了:
Assuming you are using a PictureBox or similar container, then drawing a cross on it is pretty easy:
using (Graphics g = Graphics.FromImage(myPictureBox.Image))
{
using (Pen p = Pens.Red)
{
Point TLHC = new Point(0, 0);
Point BRHC = new Point(myPictureBox.Image.Width, myPictureBox.Image.Height);
g.DrawLine(p, new Point(TLHC.X, TLHC.Y), new Point( BRHC.X, BRHC.Y));
g.DrawLine(p, new Point(TLHC.X, BRHC.Y), new Point(BRHC.X, TLHC.Y));
}
}
将其保存回数据库的方式与您最初进入数据库时使用的原始方法相同,但是使用UPDATE命令而不是INSERT.
Saving it back to the database is the same method you original used to get in into the database in the first place, but with a UPDATE command instead of INSERT.
我接受了imagebutton不是图片...抱歉,信息不完整
i hv taken imagebutton not image...sorry for incomplete info
这篇关于在图像上画线或插入十字标记并保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文