Поделиться через


Tablet.HardwareCapabilities Property

Tablet.HardwareCapabilities Property

Gets a value from the TabletHardwareCapabilities enumeration that defines the hardware capabilities of the Tablet object.

Definition

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

Property Value

Microsoft.Ink.TabletHardwareCapabilities. The hardware capabilities of the Tablet object.

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

Integrated1 Indicates the digitizer is integrated with the display.
CursorMustTouch2 Indicates the cursor must be in physical contact with the device to report position.
HardProximity4 Indicates the device can generate in-air packets when the cursor is in the physical detection range (proximity) of the device.
CursorsHavePhysicalIds8 Indicates the device can uniquely identify the active cursor.

Remarks

The hardware capabilties of a Tablet object include whether a cursor must be in physical contact with the tablet to report its position and whether the digitizer is integrated with the display. Use a bitwise comparison to determine which hardware capabilities are available for a particular Tablet object. For a complete list of hardware capability values, see the TabletHardwareCapabilities enumeration type.

Examples

[C#]

This C# example reports on the properties in each Tablet object that is available in the Tablets collection, theTablets.

using Microsoft.Ink;
// . . .
public string ReportOnEachTablet()
{
    Tablets theTablets = new Tablets();
    string theReport = Environment.NewLine;

    // Iterate over the Tablet objects in the collection, reporting on each one.
    foreach (Tablet theTablet in theTablets)
    {
        theReport += "Tablet Name: " + theTablet.Name + Environment.NewLine;
        if (theTablets.DefaultTablet.Name.Equals(theTablet.Name))
            theReport += "(Default)" + Environment.NewLine;
        theReport += "PlugAndPlayId: " + theTablet.PlugAndPlayId + Environment.NewLine;
        theReport += "HardwareCapabilities: " + theTablet.HardwareCapabilities.ToString() + Environment.NewLine;
        if ((theTablet.HardwareCapabilities & TabletHardwareCapabilities.CursorMustTouch) != 0)
            theReport += "    CursorMustTouch" + Environment.NewLine;
        if ((theTablet.HardwareCapabilities & TabletHardwareCapabilities.CursorsHavePhysicalIds) != 0)
            theReport += "    CursorsHavePhysicalIds" + Environment.NewLine;
        if ((theTablet.HardwareCapabilities & TabletHardwareCapabilities.HardProximity) != 0)
            theReport += "    HardProximity" + Environment.NewLine;
        if ((theTablet.HardwareCapabilities & TabletHardwareCapabilities.Integrated) != 0)
            theReport += "    Integrated" + Environment.NewLine;
        theReport += "MaximumInputRectangle " + theTablet.MaximumInputRectangle.ToString() + Environment.NewLine;

        // Report on each supported PacketProperty.
        theReport += "IsPacketPropertySupported:" + Environment.NewLine;
        theReport += GetProperty(theTablet, PacketProperty.AltitudeOrientation, "AltitudeOrientation");
        theReport += GetProperty(theTablet, PacketProperty.AzimuthOrientation, "AzimuthOrientation");
        theReport += GetProperty(theTablet, PacketProperty.ButtonPressure, "ButtonPressure");
        theReport += GetProperty(theTablet, PacketProperty.NormalPressure, "NormalPressure");
        theReport += GetProperty(theTablet, PacketProperty.PacketStatus, "PacketStatus");
        theReport += GetProperty(theTablet, PacketProperty.PitchRotation, "PitchRotation");
        theReport += GetProperty(theTablet, PacketProperty.RollRotation, "RollRotation");
        theReport += GetProperty(theTablet, PacketProperty.SerialNumber, "SerialNumber");
        theReport += GetProperty(theTablet, PacketProperty.TangentPressure, "TangentPressure");
        theReport += GetProperty(theTablet, PacketProperty.TimerTick, "TimerTick");
        theReport += GetProperty(theTablet, PacketProperty.TwistOrientation, "TwistOrientation");
        theReport += GetProperty(theTablet, PacketProperty.X, "X");
        theReport += GetProperty(theTablet, PacketProperty.XTiltOrientation, "XTiltOrientation");
        theReport += GetProperty(theTablet, PacketProperty.Y, "Y");
        theReport += GetProperty(theTablet, PacketProperty.YawRotation, "YawRotation");
        theReport += GetProperty(theTablet, PacketProperty.YTiltOrientation, "YTiltOrientation");
        theReport += GetProperty(theTablet, PacketProperty.Z, "Z");
        theReport += Environment.NewLine;
    }
    return theReport;
}

public string GetProperty(Tablet theTablet, Guid theGuid, string name)
{
    string theReport = "";
    // If this particular property is supported,
    // report the name and property metrics information.
    if (theTablet.IsPacketPropertySupported(theGuid))
    {
        TabletPropertyMetrics theMetrics = theTablet.GetPropertyMetrics(theGuid);

        theReport += "    " + name + Environment.NewLine +
            "        Max: " + theMetrics.Maximum.ToString() + Environment.NewLine +
            "        Min: " + theMetrics.Minimum.ToString() + Environment.NewLine +
            "        Resolution: " + theMetrics.Resolution.ToString() + Environment.NewLine +
            "        Units: " + theMetrics.Units.ToString() + Environment.NewLine;
    }
    return theReport;
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example reports on the properties in each Tablet object that is available in the Tablets collection, theTablets.

Imports Microsoft.Ink
' . . .
Public Function ReportOnEachTablet() As String
    Dim theTablets As Tablets = New Tablets()
    Dim theReport As String
    theReport = vbCrLf
    'Iterate over the Tablet objects in the collection,
    'reporting on each one.
    Dim theTablet As Tablet
    For Each theTablet In theTablets
        theReport &= "Tablet Name: " & theTablet.Name & vbCrLf
        If theTablets.DefaultTablet.Name.Equals(theTablet.Name) Then
            theReport &= "(Default)" & vbCrLf
        End If
        theReport &= "PlugAndPlayId: " & theTablet.PlugAndPlayId & vbCrLf
        theReport &= "HardwareCapabilities: " & _
            theTablet.HardwareCapabilities.ToString() & vbCrLf
        If (theTablet.HardwareCapabilities And _
            TabletHardwareCapabilities.CursorMustTouch) <> 0 Then
            theReport &= "    CursorMustTouch" & vbCrLf
        End If
        If (theTablet.HardwareCapabilities And _
            TabletHardwareCapabilities.CursorsHavePhysicalIds) <> 0 Then
            theReport &= "    CursorsHavePhysicalIds" & vbCrLf
        End If
        If (theTablet.HardwareCapabilities And _
            TabletHardwareCapabilities.HardProximity) <> 0 Then
            theReport &= "    HardProximity" & vbCrLf
        End If
        If (theTablet.HardwareCapabilities And _
            TabletHardwareCapabilities.Integrated) <> 0 Then
            theReport &= "    Integrated" & vbCrLf
        End If
        theReport &= "MaximumInputRectangle " & theTablet.MaximumInputRectangle.ToString() & vbCrLf

        'Report on each supported Packet Property.
        theReport &= "IsPacketPropertySupported:" & vbCrLf
        theReport &= GetProperty(theTablet, _
            PacketProperty.AltitudeOrientation, _
            "AltitudeOrientation")
        theReport &= GetProperty(theTablet, _
            PacketProperty.AzimuthOrientation, _
            "AzimuthOrientation")
        theReport &= GetProperty(theTablet, _
            PacketProperty.ButtonPressure, "ButtonPressure")
        theReport &= GetProperty(theTablet, _
            PacketProperty.NormalPressure, NormalPressure")
        theReport &= GetProperty(theTablet, _
            PacketProperty.PacketStatus, "PacketStatus")
        theReport &= GetProperty(theTablet, _
            PacketProperty.PitchRotation, PitchRotation")
        theReport &= GetProperty(theTablet, _
            PacketProperty.RollRotation, "RollRotation")
        theReport &= GetProperty(theTablet, _
            PacketProperty.SerialNumber, "SerialNumber")
        theReport &= GetProperty(theTablet, _
            PacketProperty.TangentPressure, "TangentPressure")
        theReport &= GetProperty(theTablet, _
            PacketProperty.TimerTick, "TimerTick")
        theReport &= GetProperty(theTablet, _
            PacketProperty.TwistOrientation, "TwistOrientation")
        theReport &= GetProperty(theTablet, PacketProperty.X, "X")
        theReport &= GetProperty(theTablet, _
            PacketProperty.XTiltOrientation, "XTiltOrientation")
        theReport &= GetProperty(theTablet, PacketProperty.Y, "Y")
        theReport &= GetProperty(theTablet, _
            PacketProperty.YawRotation, "YawRotation")
        theReport &= GetProperty(theTablet, _
            PacketProperty.YTiltOrientation, "YTiltOrientation")
        theReport &= GetProperty(theTablet, PacketProperty.Z, "Z")
        theReport &= vbCrLf
    Next

    Return theReport
End Function

Public Function GetProperty( _
    ByVal theTablet As Tablet, _
    ByVal theGuid As Guid, _
    ByVal name As String) As String
    Dim theReport As String = ""
    ' If this particular property is supported,
    ' report the name and property metrics information.
    If theTablet.IsPacketPropertySupported(theGuid) Then
        Dim theMetrics As TabletPropertyMetrics = _
            theTablet.GetPropertyMetrics(theGuid)
        theReport &= "    " & name & vbCrLf & _
            "        Max: " & theMetrics.Maximum.ToString() & vbCrLf & _
            "        Min: " & theMetrics.Minimum.ToString() & vbCrLf & _
            "        Resolution: " & theMetrics.Resolution.ToString() & _
            vbCrLf & _
            "        Units: " & theMetrics.Units.ToString() & vbCrLf
    End If
    Return theReport
End Function

See Also