Julia Lerman Blog

INETA Poster Child blabbing about community and code

Sponsors

.About Me

.Chick Blogs (yes I am highlighting them!)

.Coming Soon

.NET User Groups

A small slice of blogs I read

Articles & Talks

Conferences

Developer Book Reviews

Elsewhere...

Showing Off

some random U.G. Leader Blogs

Tablet

Implementing Undo/Redo in Managed Ink Objects

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).Id
Dim 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
With
InkPicture1.Refresh()

Case "redo"
If DeletedStrokes.Count > 0
Then
Dim storeInk As
Ink = DeletedStrokes(DeletedStrokes.Count - 1)
InkPicture1.Ink.AddStrokesAtRectangle(storeInk.Strokes, thisink.GetBoundingBox)
DeletedStrokes.Remove(thisink)
InkPicture1.Refresh()
End If

Posted: Dec 18 2003, 10:17 PM by jlerman | with 3 comment(s)
Filed under:

Comments

Maxim V. Karpov said:

It looks like you are having fun with your TabletPC.
Do you like object model so far for INK?

www.ipattern.com (do you?)
# December 19, 2003 10:56 AM

Avril Kuree said:

Pretty cool place you've got here. Thanks for it. I like such themes and everything that is connected to this matter. I would like to read more on that blog soon.

Avril Kuree    

<a href="milanescorts.com/">escort girl milano</a>

# March 19, 2011 9:34 AM

Hilary Kuree said:

It is rather interesting for me to read the post. Thanx for it. I like such topics and everything that is connected to them. I definitely want to read a bit more soon.  

Hilary Kuree    

<a href="www.pickescort.com/">escorts of london</a>

# April 26, 2011 7:00 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)