Ti può essere utile questo:
This C# example demonstrates using the Stroke event handler to store a custom property in each stroke that contains a timestamp, by using the ExtendedProperties member. This sample started with a generated C# application and added a button and a list box to the main form. Each stroke drawn on the form stores a timestamp in its extended properties. When the button is pressed, the list box is filled with a list of the timestamps of the strokes.
//...
using Microsoft.Ink;
namespace CS_StrokeEvent
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button button1;
//...
// Add the following after Main() in the generated code.
InkCollector myInkCollector;
// This GUID constant will be used for the strokes'
// timestamp extended property.
Guid myTimeGuid = new Guid(10, 11, 12, 10, 0, 0, 0, 0, 0, 0, 0);
private void Form1_Load(object sender, System.EventArgs e)
{
// Initialize the InkCollector with the form's
// window handle, then enable it.
myInkCollector = new InkCollector(Handle);
myInkCollector.Enabled = true;
// Add a handler for Stroke Events so we can record
// an extended property with each one.
myInkCollector.Stroke += new InkCollectorStrokeEventHandler(MyStrokeHandler);
}
public void MyStrokeHandler(object sender, InkCollectorStrokeEventArgs e)
{
// Write the current time into this stroke.
// First get the time as a long.
long theTime = DateTime.Now.ToFileTime();
// Store the data under the Guid key.
e.Stroke.ExtendedProperties.Add(myTimeGuid, theTime);
}
private void PopulateList()
{
//Clear the list before repopulating it.
listBox1.Items.Clear();
// Query the InkCollector's Ink for its strokes collection.
Strokes theStrokes = myInkCollector.Ink.Strokes;
foreach (Stroke theStroke in theStrokes)
{
// Test for the timestamp property on this stroke.
if (theStroke.ExtendedProperties.DoesPropertyExist(myTimeGuid))
{
// Get the raw data out of this stroke's extended
// properties list, using the previously defined
// Guid as a key to the wanted extended property.
long theLong = (long)theStroke.ExtendedProperties[myTimeGuid].Data;
// Then turn it (as a FileTime) into a time string.
string theTime = DateTime.FromFileTime(theLong).ToString();
// Add the string to the listbox.
listBox1.Items.Add(theTime);
}
}
}
private void button1_Click(object sender, System.EventArgs e)
{
PopulateList();
}
}
}
Lo trovi in MSDN Library (ms-help://MS.MSDNQTR.2003FEB.1040/tpcsdk10/html/reference/tbevtstroke.htm).
Ciao.
SuperCap
(Le risposte che lascio sono limitate alle mie conoscenze sull'argomento trattato. Quindi potrei anche sbagliare!)