0

我需要类似于Silverlight InkPresenter的东西,它允许将手绘图保存到图片上(因此将固定背景和绘制的前景保存到最终图片中)。

但是,我们有许多客户不会使用 Silverlight,也不会在他们的机器上升级到 .Net 2 以上。所以,我很难找到适合这项工作的工具(或者即使存在一个考虑到我的限制):

我已经为 .Net2 客户端使用了 Tablet PC 附加功能,但它并不是特别好。我想知道还有哪些其他选择?理想情况下使用基于 Web 的 .Net (3.5/4) 或 JavaScript API。

4

2 回答 2

0

理想情况下使用基于 Web 的 .Net (3.5/4) 或 JavaScript API。

好吧,如果您的客户不会升级到 NET 2.0 以上,那么这条途径就是正确的!

使用 Photoshop 甚至Paint.NET生成图形有什么问题。Paint.NET 是免费的(接受捐赠)并允许您将图像存储在多个层中,然后您可以将其“压缩”为位图、jpeg 等,用作 Winforms/ASP 页面上的图像。

编辑忽略前面的答案

如果您追求自由手绘功能,那么看看是否满足您的需求。我知道它主要是矢量图形,但其中可能有一些你可以使用的东西,如果你订阅了,你就会得到源代码。

否则,如果您的服务器可以使用比 2 更高级别的 NET 版本,那么如何使用 WPF 拖放预定义的控件/元素。

于 2011-11-01T14:36:18.167 回答
0

替代方法:我可以使用以下代码将控件保存为位图,而不是使用 Ink API 保存图像。

它确实有一些缺点(例如一旦保存它就不可编辑,但这对于这种情况来说是件好事)。

Public Shared Sub SaveAsBitmap(ByVal control As Windows.Forms.Control, ByVal fileName As String, ByVal imageFormat As Imaging.ImageFormat)
    Dim bmp As Bitmap = ConvertToBitmap(control)
    bmp.Save(fileName, imageFormat)
    bmp.Dispose()
End Sub

Public Shared Function ConvertToBitmap(ByVal control As Windows.Forms.Control) As Bitmap
    //get the instance of the graphics from the control
    Dim g As Graphics = control.CreateGraphics()
    //new bitmap object to save the image      
    Dim bmp As New Bitmap(control.Width, control.Height)
    //Drawing control to the bitmap       
    control.DrawToBitmap(bmp, New Rectangle(0, 0, control.Width, control.Height))
    Return bmp
End Function
于 2011-11-01T16:53:22.867 回答