[英]How to generate images on the fly in ASP.NET
As the title says, how can generate (and display) images on the fly for simple charting, resizing etc? 如标题所述,如何动态生成(显示)图像以进行简单的制图,调整大小等?
Thanks 谢谢
For charting, you may want to look into the ASP.NET Chart Control. 对于制图,您可能需要查看ASP.NET图表控件。
http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx
Use System.Drawing
namespace. 使用
System.Drawing
命名空间。
Add a reference to System.Drawing
assembly. 添加对
System.Drawing
程序集的引用。 Create a new Bitmap
class. 创建一个新的
Bitmap
类。 Call CreateGraphics
on it. 在其上调用
CreateGraphics
。 Use the returned Graphics
object to do your drawing. 使用返回的
Graphics
对象进行绘制。 Set the Response.ContentType
to the appropriate image MIME type. 将
Response.ContentType
设置为适当的图像MIME类型。 Finally save the Bitmap
to the Response.Output
stream. 最后,将
Bitmap
保存到Response.Output
流。
检查有关System.Drawing和ASP.NET的警告。http: //msdn.microsoft.com/zh-cn/library/system.drawing.aspx如果现在正在使用,请使用WPF http:// www。 codeproject.com/KB/WPF/WPF-Image-to-WebPage.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.