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


Tablet.PlugAndPlayId Property

Tablet.PlugAndPlayId Property

Gets a string representation of the Plug and Play identifier of the Tablet object.

Definition

Visual Basic .NET Public ReadOnly Property PlugAndPlayId As String
C# public string PlugAndPlayId { get; }
Managed C++ public: __property String* get_PlugAndPlayId();

Property Value

System.String. The Plug and Play identifier of the Tablet object.

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

Remarks

The return value is based upon the HIDD_ATTRIBUTES.ProductID Leave Site element. The manufacturer of the tablet device is responsible for adding this string. The return value is empty if the tablet device does not have an identifier.

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 PacketProperty.
        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