如何在Asp.net的webform上绘制曲线或箭头? [英] How to draw curve line or arrow on webform in Asp.net ?

查看:68
本文介绍了如何在Asp.net的webform上绘制曲线或箭头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我吗?

如何在Asp.net中的Webform上绘制曲线或箭头?

谢谢.

Can anybody help me ?

How to draw curve line or arrow on webform in Asp.net ?

Thanks.

推荐答案

可以有不同的方法.您可以使用以下HTML5功能即时生成Canvas绘图:
http://www.w3schools.com/html/html5_canvas.asp [ http://en.wikipedia.org/wiki/HTML5 [ http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28HTML5%29 [ ^ ].

另外,您可以使用System.Drawing.Bitmap:
在服务器端绘制所有内容 http://msdn.microsoft.com/en-us/library/system.drawing. bitmap.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.drawing. image.aspx [^ ].

要绘制位图,应使用从Bitmap实例获得的System.Drawing.Graphics实例或任何其他类型的System.Drawing.Image实例:
http://msdn.microsoft.com/en-us/library/system. drawing.graphics.fromimage.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.drawing. graphics.aspx [^ ].

然后,您可以在服务器端写一个位图文件,并通过<img>元素将其传递给客户端,该元素的值src属性包含图像的URI.或者,您可以生成具有适当内容类型的整个HTTP响应,以直接仅显示图形,而无需创建任何文件.

—SA
There can be different approaches. You can generate Canvas drawing on the fly, using this HTML5 feature:
http://www.w3schools.com/html/html5_canvas.asp[^].

The problem with that is not all Web browsers support HTML5 to the required degree. To check up, please see:
http://en.wikipedia.org/wiki/HTML5[^],
http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28HTML5%29[^].

Alternatively, you can draw everything on the server side, using System.Drawing.Bitmap:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx[^].

To draw on the bitmap, you should use the instance of the System.Drawing.Graphics obtained from the instance of Bitmap or an instance of any other type of System.Drawing.Image:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx[^].

Then you can write a bitmap file on the server side and deliver it to the client through the <img> element with the value of src attribute containing the URI of your image. Alternatively, you can generate the whole HTTP response with appropriate content type to show just the graphics directly, without creating any files.

—SA


这篇关于如何在Asp.net的webform上绘制曲线或箭头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆