Compartir a través de


Tablet.HardwareCapabilities Property

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

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

'Declaration
Public ReadOnly Property HardwareCapabilities As TabletHardwareCapabilities
'Usage
Dim instance As Tablet
Dim value As TabletHardwareCapabilities

value = instance.HardwareCapabilities
public TabletHardwareCapabilities HardwareCapabilities { get; }
public:
property TabletHardwareCapabilities HardwareCapabilities {
    TabletHardwareCapabilities get ();
}
/** @property */
public TabletHardwareCapabilities get_HardwareCapabilities ()
public function get HardwareCapabilities () : TabletHardwareCapabilities
Not applicable.

Property Value

The hardware capabilities of the Tablet object.

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.

Note

This function can be re-entered if called within certain message handlers, causing unexpected results. Take care to avoid a reentrant call when handling any of the following messages: WM_ACTIVATE, WM_ACTIVATEAPP, WM_NCACTIVATE, WM_PAINT; WM_SYSCOMMAND if wParam is set to SC_HOTKEY or SC_TASKLIST; and WM_SYSKEYDOWN (when processing Alt-Tab or Alt-Esc key combinations). This is an issue with single-threaded apartment model applications.

Example

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;
}

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

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Tablet Class
Tablet Members
Microsoft.Ink Namespace
TabletHardwareCapabilities