Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Stefan Wick
Mark Hopkins
Microsoft Corporation
February 2006
Applies to:
Microsoft Windows XP Tablet PC Edition
Summary: The Ink Explorer is a sample application that provides access to all the properties of ink strokes for examination by the user. It is a very useful tool for understanding the architecture of the Microsoft Windows XP Tablet PC Edition implementation of digital ink. (5 printed pages)
Click here to download the sample code for this article.
What is the Ink Explorer?
Ink Explorer Functionality
Exploring Ink
The Source Code
Conclusion
Ink Explorer is a sample application that the Tablet PC team sometimes uses at conferences when discussing the architecture of digital ink in Microsoft Windows XP Tablet PC Edition. Ink Explorer is very useful for learning about how to use the ink APIs, containing good examples of the kind of code necessary to use in ink-enabled applications.
Ink Explorer has three control areas in its main window:
Ink Explorer uses the InkPicture control to capture ink strokes for analysis. To modify the attributes of the strokes, click Pen Settings on the Tools menu.
The TreeView control displays the hierarchy of the Ink object and the strokes contained within it. This includes properties such as the DrawingAttributes and ExtendedProperties collection on a Stroke. This view gives a very nice conceptual picture of the Ink architecture.
The ListView displays information about the item currently selected in the TreeView. For example, if you click an individual stroke in the TreeView pane (Stroke_1, in the example screenshot in Figure 1), you see all of the packet data for that stroke. This is more fully explained in Exploring Ink, later in this article.
Figure 1. Screenshot of Ink Explorer. Note that TreeView, ListView, and InkPicture are labels on the screenshot. The labels do not appear in the sample application.
The menus provide access to the functions you would expect to find in an ink-enabled application, with a few notable exceptions. The View menu contains the Rotate command, which rotates the ink 45 degrees. The Tools menu contains the Divide Ink command, which copies all the strokes into the CustomStrokes of the parent Ink object. In addition to the main menu bar, there are context menus available in the TreeView pane, which are discussed in more detail in Exploring Ink, later in this article.
The real value of Ink Explorer comes from experimenting with ink. Use the following steps to become familiar with the tool.
Try using different inking modes.
One of the most important aspects of the ink experience for an end user is the look and feel of the ink. You achieve this through the DrawingAttributes object assigned to each Stroke. A DrawingAttributes object describes how any known set of ink is to be drawn. A DrawingAttributes object includes basic properties such as Color, Width, and PenTip. It can also encompass advanced parameters, such as variable transparency and Bezier smoothing, that can provide interesting effects or improve ink readability.
Note what happens to the way the Stroke is rendered. You can use the DrawingAttributes to give instant and meaningful feedback to the user.
Ink Explorer renders a visual representation of an Ink object. This may lead you to some new solutions that you hadn't considered before. For example, notice how many different places there are to store ExtendedProperties. Using the various properties may give you some extraordinary results. Try the following experiment:
In Ink Explorer, click the File menu, and then click Clear.
Click the Mode menu, and then click Ink.
Draw some ink in the InkPicture control.
Completely expand the Strokes collection. Notice that there is an ExtendedProperties property on:
That's a lot of places to store your own data!
Right-click the ExtendedProperties node for the first Stroke in your collection, and then click Add Property. Notice that the Guid field is already populated by Ink Explorer. Each extended property is a GUID/value pair.
In the Value field of the AddProperty TextBox type, This is an extended property.
Click OK.
Click the File menu, click Save As, and save the ink as an Ink Serialized Format (ISF) file.
Click the File menu, and then click Clear to remove all the ink.
Click the File menu, click Open, and open the file you just saved.
Click the ExtendedProperties node for the first Stroke in your collection. The ExtendedProperties data is still there. The system stored and retrieved the data with the ink.
Use the ExtendedProperties to hold many types of useful information that you can access through this API. Feel free to try things on your own. Experiment!
The source code included with the Ink Explorer sample provides an excellent opportunity to see how to access the attributes of the Ink class. The code is organized by window. There are individual C# source files for:
The most interesting code is in the MainForm.cs file. The Menu event handlers region begins on line 1075 and contains the event handlers for all the menu choices. Some of the more interesting event handlers include:
Additionally, there are more menu event handlers for you to explore. Also, be certain to look at the UpdateTreeView and UpdateListView methods. These methods do all the work to extract and display the information about the strokes, such as X and Y point information, drawing attributes, and so on.
The Ink Explorer is an excellent tool for learning about the architecture of the Windows XP Tablet PC Edition platform. You can experiment with ink and get a good visual representation of the effects of your changes.
Please sign in to use this experience.
Sign in