Ink Web Control Sample

Ink Web Control Sample

Ink Web Control Sample

Description of the Ink Web Control sample for the Tablet PC.

This sample shows how to create an ink-enabled control for use in a Web browser. The sample takes the original Auto Claims Form Sample and turns it into a control that is put on a Web page.

For more information about using ink on the Web, see Using Ink on the Web.

Modifications to the Original Sample Project

This sample consists of a solution that includes two projects and an HTML file. The first project, AutoClaims, is a Microsoft® Visual C#® Control Library project (a User Control). The source code for this control is almost identical to that of the AutoClaims sample with two differences:

  • The AutoClaims class in this sample inherits from the UserControl Leave Site class rather than the Form Leave Site class.
    public class AutoClaims : System.Windows.Forms.UserControl 
  • The AutoClaims class in this sample has an added public method, DisposeResources, that disposes of the internal child controls used for collecting ink. This method must be called by the Web page on which the control is used when that page is finished using the control.

Referencing the Control in HTML

The solution includes an HTML file, default.htm. This file is the page that the browser navigates to in order to load the control. The file contains an <object> tag that references the control. It also includes a script that is called when the page unloads, as indicated by the presence of the onload="OnUnload()" attribute in the <body> tag. This function calls the DisposeResources method on the control to make sure that all resources are properly released at shutdown.

    <script language="jscript">
        // Release any resouces held by the AutoClaims control
        function OnUnload()
        <title>AutoClaims (Web Control)</title>
    <body onunload="OnUnload()">

Notice the format of the classid attribute value for the <object> tag. It names the assembly, followed with a # sign separator, and then the namespace that contains the control and then the class name of the control.

A real-world user control would likely include additional methods used to persist or send the data collected in the application.

The AutoClaims_WebControl Project

The AutoClaims_WebControl project is a Deployment Project that creates a setup that adds a virtual root, AutoClaims_WebControl, on the Web server when installed. The control and the HTML file are placed in this virtual root.

Related Topics

© 2016 Microsoft