I had some difficulty figuring this out. ALthough the ink can interact with the clipboard, I wanted to have an explicit place to tuck away my strokes and retrieve them again. A few hints in the Tablet Newsgroup pointed me in to some interesting methods and I was able to come up with the following solution. Take a look at the functionality of ink.CreateStrokes, ink.ExtractStrokes and ink.AddStrokestoRectangle to better understand this code.
(DeletedStrokes is just a ListArray created elsewhere in the class)
Case "undo"
With (InkPicture1.Ink)Dim id As Int32 = .Strokes(.Strokes.Count - 1).IdDim ids() As Int32 = {id}Dim delStrokes As Strokes = .CreateStrokes(ids)Dim storeInk As Ink = .ExtractStrokes(delStrokes, ExtractFlags.RemoveFromOriginal)DeletedStrokes.Add(storeInk).Strokes.Remove(.Strokes(.Strokes.Count - 1))End WithInkPicture1.Refresh()
Case "redo"If DeletedStrokes.Count > 0 ThenDim storeInk As Ink = DeletedStrokes(DeletedStrokes.Count - 1)InkPicture1.Ink.AddStrokesAtRectangle(storeInk.Strokes, thisink.GetBoundingBox)DeletedStrokes.Remove(thisink)InkPicture1.Refresh()End If
Remember Me
See my speaking schedule for more events
User Group Leader
Hosted by:
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Julie Lerman
E-mail