网页上的图形输出 [英] Graphical Outputs on Web page
问题描述
我想在网页上开发一个带有主要图形输出的网络解决方案,如流程图。我的意思是在执行一些活动之后,它应该在网页上将其显示为一个BOX,并简要描述活动。此框也应该在场景后面有一些元数据来编辑它。我可以通过编写自定义/用户控件使用ASP.Net来做到这一点。但是因为屏幕上可能有大约150个这样的图形框,所以在每次回发后处理渲染所有框都变成了噩梦。
我知道我们可以使用Silverlight或其他一些基于客户端的图形应用程序,但我没有足够的时间进行研究。谁能告诉我如何使用ASP.Net来实现目标?
I wants to develop a web solution with major Graphical Outputs like flowcharts on the webpage. I mean after performing some activity it should display it as a BOX on the web page with brief description about the activity. Also the box should have some meta data behind the scene to edit it. I can do this using ASP.Net by writing custom/user controls. But as there could be around 150 such graphical boxes on the screen so it became nightmare to handle the rendering all the boxes after every post back.
I know that we can use Silverlight or some other client based Graphical Applications but I don’t have enough time to do research. Can anyone please tell me how to achieve the objective using ASP.Net only?
推荐答案
噩梦在哪里?你只需要系统地处理它。
使用 System.Drawing.Bitmap <可以使用ASP.NET动态创建图像/ code>。创建所需大小的位图并在其上动态绘制(如果许多位图有很多共同点,则从预先创建的文件加载并在顶部添加一些图形)。要绘制位图,请使用System.Drawing.Graphics.FromImage $从位图实例获取
System.Drawing.Graphics
的实例C $ C>。请参阅:
http://msdn.microsoft.com /en-us/library/system.drawing.bitmap.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx [ ^ ] 。
现在,如何处理图像?您可以将其保存在临时文件中,并在页面上生成的< img>
元素中使用它,但您也可以在没有文件的情况下在文件上显示图像,如果您使用适当的HTTP 标头在HTTP响应流中返回它。请参阅:
http://en.wikipedia.org/wiki/Media_type#Type_image [ ^ ],
http://tools.ietf.org/html/rfc6648 [ ^ ]。
如需使用的基本样本System.Web.HttpResponse
动态生成位图,只需在此类的MSDN帮助页面中查看示例:http://msdn.microsoft.com/en-us/library/system.web.httpresponse%28v = vs.80%29.aspx [ ^ ]。
-SA
And where is the nightmare? You just need to approach it systematically.
The images can be created on the fly with ASP.NET by usingSystem.Drawing.Bitmap
. Create a bitmap of the required size and dynamically draw on it (if many bitmaps have a lot in common, load then from pre-created files and add some graphics on top). To draw on a bitmap, obtain an instance of theSystem.Drawing.Graphics
from a bitmap instance usingSystem.Drawing.Graphics.FromImage
. Please see:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx[^].
Now, what to do with the image? You can save it in a temporary file and use it in a<img>
element generated on a page, but you also can present an image on the file without a file, if you return it in a stream of a HTTP response, using an appropriate HTTP header. Please see:
http://en.wikipedia.org/wiki/Media_type#Type_image[^],
http://tools.ietf.org/html/rfc6648[^].
For a basic sample of the use ofSystem.Web.HttpResponse
generating a bitmap on the fly, just see a sample in a MSDN help page on this class: http://msdn.microsoft.com/en-us/library/system.web.httpresponse%28v=vs.80%29.aspx[^].
—SA
这篇关于网页上的图形输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!