Freigeben über


InkCollector.Tablet Property

InkCollector.Tablet Property

Gets the tablet device that the InkCollector object is currently using to collect input.

Definition

Visual Basic .NET Public ReadOnly Property Tablet As Tablet
C# public Tablet Tablet { get; }
Managed C++ public: __property Tablet* get_Tablet();

Property Value

Microsoft.Ink.Tablet. The tablet device that the InkCollector object is currently using to collect input.

This property is read-only. This property has no default value.

Exceptions

COMException Leave Site:
InvalidOperationException Leave Site: Tablet is not available in all tablets mode
ObjectDisposedException Leave Site:

Remarks

Note: This property is valid only when the InkCollector is collecting ink from just one tablet. Accessing this property for an InkCollector that is collecting ink from more than one tablet generates an exception.

Examples

[C#]

This C# example returns a report on the properties of the Tablet object, collectorTablet, referenced by the InkCollector object, theInkCollector, that is passed in as a parameter.

using Microsoft.Ink;
//. . .
public string InkCollectorTabletReport(InkCollector theInkCollector)
{
    string theReport = "";

    //
    // We wrap access to the Tablet object in a try / catch block here because the InkCollector might
    // be in all tablets mode.  If it is, and we try to access the Tablet property, an exception will be
    // thrown.
    //
    try
    {
        theReport = "The tablet associated with this InkCollector has the following properties:" + Environment.NewLine;
        Microsoft.Ink.Tablet collectorTablet = theInkCollector.Tablet;

        theReport += "Tablet Name        = " + collectorTablet.Name + Environment.NewLine;
        theReport += "Tablet PNP ID        = " + collectorTablet.PlugAndPlayId + Environment.NewLine;
        theReport += "Tablet Max Rect    = " + collectorTablet.MaximumInputRectangle.ToString() +
                      Environment.NewLine;
        theReport += "Tablet Capabilities = " + collectorTablet.HardwareCapabilities + Environment.NewLine;
    }
    catch (System.Exception)
    {
        theReport = "The InkCollector is in all tablets mode." + Environment.NewLine;
        theReport += "The tablet report cannot be generated." + Environment.NewLine;
    }

    return theReport;
}
            

[VB.NET]

This Microsoft® Visual Basic® .NET example returns a report on the properties of the Tablet object, collectorTablet, referenced by the InkCollector object, theInkCollector, that is passed in as a parameter.

Imports Microsoft.Ink
'. . .
Public Function InkCollectorTabletReport(ByVal theInkCollector As InkCollector)
    On Error Resume Next
    Dim theReport As String

    '
    ' Accessing the tablet property of the InkCollector might throw an exception if
    ' the InkCollector object is in all tablets mode.  We check Err.Number and use On Error Resume Next
    ' to handle this situation
    '
    Dim collectorTablet As Tablet = theInkCollector.Tablet
    If (Err.Number = 0) Then

        theReport = "The tablet associated with this InkCollector has the following properties:" & vbCrLf

        theReport &= "Tablet Name         = " & collectorTablet.Name & vbCrLf
        theReport &= "Tablet PNP ID       = " & collectorTablet.PlugAndPlayId & vbCrLf
        theReport &= "Tablet Max Rect     = " & collectorTablet.MaximumInputRectangle.ToString() & vbCrLf
        theReport &= "Tablet Capabilities = " & collectorTablet.HardwareCapabilities & vbCrLf
    Else
        theReport = "The InkCollector is in all tablets mode." & vbCrLf
        theReport &= "The tablet report cannot be generated." & vbCrLf
    End If

    Return theReport
End Function

        

See Also