views:

26

answers:

1

I would like to display strokes that I have saved previously on an inkPicture Object in Ms Access (it is on a form via ActiveX).

The strokes are saved in a table as an ole-object in the field 'Strokes'.

Now, doing it once is easy enough (one line of code), I can use this snippet without any problem :

Public Sub loadInkImage(MyInkPic As MSINKAUTLib.InkPicture)       

    MyInkPic.Object.Ink.Load (Me.Strokes)       

End Sub

The problem comes in when I want to do it a second time : the inkpicture is not 'clean' any more and cannot load the strokes.
Just deleting the existing strokes doesn't work, so how can I fill the same inkpicture again ?

Thanks!

+1  A: 

Are you trying to load two sets of strokes into the same object, or just reload a new set of strokes into the InkPicture? If you want to reload strokes you need to create a new InkDisp Object then assign it to the InkPicture.

Public Sub loadInkImage(MyInkPic As MSINKAUTLib.InkPicture)

    Dim newInk As New MSINKAUTLib.InkDisp 'need new object to load new ink

    newInk.Load Me.Strokes 'load in the ink

    Set MyInkPic.Ink = newInk 'set the InkPictures Ink to the new Ink
End Sub

Note: I currently do not have the ability to test this, so it might need tweaking.

Fink
It needed some tweaking : inkPic.InkEnabled = False and back to true, but other than that : thanks man! wish I could assign more than one point!
Peter