Question

I need something similar to the Silverlight InkPresenter, that allows a freehand drawing to be saved onto a picture (so a fixed background and a drawn foreground saved into one final picture).

However we have a number of customers who won't use Silverlight and won't upgrade beyond .Net 2 on their machines. So, I'm having trouble finding the right tool for the job (or even if one exists given my constraints):

I have used Tablet PC additions for the .Net2 client, but it isn't particularly good. I wondered what other options were available? Ideally using web-based .Net (3.5/4) or JavaScript API.

Was it helpful?

Solution

Ideally using web-based .Net (3.5/4) or JavaScript API.

Well if your customers wont upgrade beyond NET 2.0 then this avenue is right out!

What's wrong with using Photoshop or even Paint.NET to produce your graphics. Paint.NET is free (donations accepted) and allows you to store images in several layers, which you can then "squash" into bitmaps, jpegs etc for use as images on Winforms/ASP pages.

EDIT Ignore the previous answer

If you're after free hand drawing functionality then have a look at this and see if it meets your needs. I know that it's mainly vector graphics, but there may be something in it that you can use and if you subscribe you get the source code.

Otherwise if you servers can use a higher level NET version than 2 then how about drag and drop of predefined controls/elements using WPF.

OTHER TIPS

Alternative approach: Instead of using the Ink API to save the image, I can use the following code to save the control as a bitmap.

It does have some drawbacks (such as once it is saved it isn't editable, but that's a good thing for this scenario).

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top