Where's my Silverlight pen?
|
I have seen a bunch of flash advertisements that let you draw on the ad, just like I have been doing with embedded winforms controls and now with Silverlight. But there's something they all have that I couldn't figure out how to get at (but read on, because I finally did!) - a big honkin' pen or pencil "cursor"!
...and the one that breaks my heart the most, is the one for the Lenovo ThinkPad..
When working in Expression, in a Silverlight 1.0 Javascript project, the properties window tells me there are a lot of cursor options, which really teased me:
When I try to use the Pen cursor, I get run time errors telling me there is no such enumeration. When coding XAML in Visual Studio, intellisense shows me the real list:
Finally it dawned on me. Duh. This wasn't a cursor it was an image and I've seen it being used in the Silverlight Ink Tattoo Studio demo.
So I downloaded the demo and looked to see how it was done - oh so simple. Just move the image position in the MouseMove event. function InkPresenterMouseMovewithPen(sender,args) I then found a stylus image (thank you Wacom), and did a somewhat crappy, but acceptable for experimentation, job of clipping it and voila:
I've updated a few of the pages on my SilverlightInk tests to use the pen so go check it out! Hmm, maybe now I go into business designing lucrative yet aggravating web ads. |










Comments (2)
Hi,
Did you find a means of saving the ink drawn? I have to do this for an application that stores signatures. Thanks.
Mike
Posted by Michael Nyman | September 28, 2007 11:07 AM
hi mike,
i have been doing this as per this demo
thedatafarm.com/silverink
one of these days i need to write an article on this. I did it the hard way (in SL 1.0). basic concept:
- create a XAML string from the stroke collection of the inkpresenter. Send that string to a web service. you can store the xaml directly or you can use server side APIs to convert it to a WPF InkCanvas object, then use it's persistence formats to ouput to [your choice] then store the results into the database.
the most important thing is to realize is that you need to get it over to the server, then let the server used managed code to do the real work.
check my peristing ink on the web article to get some more ideas. that's tabletpc 1.7 sdk though.
Posted by Julie | October 28, 2007 8:42 PM