共用方式為


Tablet.IsPacketPropertySupported Method

Tablet.IsPacketPropertySupported Method

Returns a value that indicates whether a PacketProperty field, identified with a globally unique identifier (GUID), is supported by this Tablet object.

Definition

Visual Basic .NET Public Function IsPacketPropertySupported( _
ByVal id As Guid _
) As Boolean
C# public bool IsPacketPropertySupported(
Guid id
);
Managed C++ public: bool* IsPacketPropertySupported(
Guid *id
);

Parameters

id System.Guid.

Return Value

System.Boolean. Returns a value that indicates whether a PacketProperty field, identified with a globally unique identifier (GUID), is supported by this Tablet object.

true The PacketProperty field is supported by this Tablet object.
false The PacketProperty field is not supported by this Tablet object.

Remarks

This method determines if a Tablet object supports various fields of the PacketProperty class.

Examples

[C#]

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

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

    // Iterate over the tablets 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 Packet Property.
        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;
}
        

[VB.NET]

This Microsoft® Visual Basic® .NET example reports on the properties in each Tablet object 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 tablets 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