如何在 ASP.NET 页面中将墨迹(已捕获)显示为图像?
我有一个 .NET Windows 应用程序,它使用 Microsoft Tablet PC SDK 中的 Microsoft.Ink 收集墨迹并将其存储在数据库中。效果很好。
现在我需要在 ASP.NET 应用程序中将此墨迹显示为图像。
请注意,我不需要在 Web 应用程序中捕获任何笔画。只需将已捕获的笔画显示为图像即可。我不知道如何继续。我想我不能在网页中使用 Renderer.Draw 。
请朋友帮忙
编辑:感谢您的帮助。如果有人需要的话,这里是示例代码:
Response.Clear();
Response.ContentType = "image/jpeg";
Byte[] isf = Convert.FromBase64String("AI8BHQS6AoQBAwRIEEU1CoABNofwCMeAU9BIREIpEoZCoJpCdyGDxCUYCi8ZicV3rFIRAILEchwGGx/MEQgkD1FBoIyBBoJAoFN53LY/EYPU4LAwh+sa6m2HwCLSacReHwGDatQ2Qy2f4PkMVhcB4FiSxWARSVbmiMHguyYfBYFdSESWNSSZTySRaQSqbUCjwYA="); // Sample
ink.Load(isf);
Byte[] imageData = ink.Save(PersistenceFormat.Gif);
Response.BinaryWrite(imageData);
Response.End();
这是页面中用于显示它的图像标签:
<img alt="" src="RenderImage.aspx" />
I have a .NET windows application that collects ink using Microsoft.Ink from Microsoft Tablet PC SDK and stores it in a database. That's working fine.
Now I need to display this ink as an image in an ASP.NET application.
Note that I don't need to capture any strokes in the web application. Just display the already captured strokes as an image. I don't know how to proceed. I think I can't use Renderer.Draw in a web page.
Please help, friends
EDIT: Thanks for the help. Here's the sample code if anybody needs it:
Response.Clear();
Response.ContentType = "image/jpeg";
Byte[] isf = Convert.FromBase64String("AI8BHQS6AoQBAwRIEEU1CoABNofwCMeAU9BIREIpEoZCoJpCdyGDxCUYCi8ZicV3rFIRAILEchwGGx/MEQgkD1FBoIyBBoJAoFN53LY/EYPU4LAwh+sa6m2HwCLSacReHwGDatQ2Qy2f4PkMVhcB4FiSxWARSVbmiMHguyYfBYFdSESWNSSZTySRaQSqbUCjwYA="); // Sample
ink.Load(isf);
Byte[] imageData = ink.Save(PersistenceFormat.Gif);
Response.BinaryWrite(imageData);
Response.End();
Here's the image tag in the page to display it:
<img alt="" src="RenderImage.aspx" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://msdn.microsoft.com/en-us/library/aa515948。 aspx
您是否可以将您的 ink 对象序列化为这种格式?在这种情况下,您只需将其视为网站上的图像,同时仍然可以选择将其反序列化为 Ink 类的另一个实例
http://msdn.microsoft.com/en-us/library/aa515948.aspx
Is it possible that you serialize your ink object to this format? In this case you will just treat it as an image on your website, while still having an option of deserializating it into another instance of Ink class