Tablet.GetPropertyMetrics 方法
傳回已知之 PacketProperty 物件的度量資料。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Function GetPropertyMetrics ( _
id As Guid _
) As TabletPropertyMetrics
'用途
Dim instance As Tablet
Dim id As Guid
Dim returnValue As TabletPropertyMetrics
returnValue = instance.GetPropertyMetrics(id)
public TabletPropertyMetrics GetPropertyMetrics(
Guid id
)
public:
TabletPropertyMetrics GetPropertyMetrics(
Guid id
)
public TabletPropertyMetrics GetPropertyMetrics(
Guid id
)
public function GetPropertyMetrics(
id : Guid
) : TabletPropertyMetrics
參數
- id
型別:System.Guid
所要求之 PacketProperty 的 Guid (英文) 識別項。
傳回值
型別:Microsoft.Ink.TabletPropertyMetrics
這個方法會針對手寫板所支援之要求屬性傳回 TabletPropertyMetrics 物件。
備註
您所擷取度量資訊的屬性可以包括封包的產生時間或筆尖壓在手寫板表面上的壓力。
注意事項: |
---|
如果在特定訊息處理常式內呼叫的話,可能會重新輸入這個函式,造成非預期的結果。處理下列訊息時,請小心避免使用可重新進入的呼叫:WM_ACTIVATE、WM_ACTIVATEAPP、WM_NCACTIVATE、WM_PAINT、WM_SYSCOMMAND (如果 wParam 設定為 SC_HOTKEY 或 SC_TASKLIST) 和 WM_SYSKEYDOWN (處理 ALT+TAB 或 ALT+ESC 組合鍵時)。不過在單一執行緒 Apartment Model (STA) 應用程式中會發生問題。 |
範例
這個範例會針對 Tablets 集合的預設 Tablet 物件,回報其每個支援之屬性的屬性度量資訊。
Public Function Report_PropertyMetrics_DefaultTablet() As String
Dim SB As StringBuilder = New StringBuilder(1024)
Dim defTablet As Tablet = New Tablets().DefaultTablet
' Report on each of the property metrics for the default tablet
SB.AppendLine("Propert metrics of the default tablet: " + defTablet.Name)
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.AltitudeOrientation, "AltitudeOrientation"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.AzimuthOrientation, "AzimuthOrientation"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.ButtonPressure, "ButtonPressure"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.NormalPressure, "NormalPressure"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.PacketStatus, "PacketStatus"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.PitchRotation, "PitchRotation"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.RollRotation, "RollRotation"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.SerialNumber, "SerialNumber"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.TangentPressure, "TangentPressure"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.TimerTick, "TimerTick"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.TwistOrientation, "TwistOrientation"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.X, "X"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.XTiltOrientation, "XTiltOrientation"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.Y, "Y"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.YawRotation, "YawRotation"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.YTiltOrientation, "YTiltOrientation"))
SB.Append(GetPropertyMetrics(defTablet, PacketProperty.Z, "Z"))
Return SB.ToString()
End Function
Public Function GetPropertyMetrics( _
ByVal theTablet As Tablet, _
ByVal PropertyID As Guid, _
ByVal PropertyName As String) As String
Dim SB As StringBuilder = New StringBuilder(1024)
' If this particular property is supported,
' report the name and property metrics information.
If theTablet.IsPacketPropertySupported(PropertyID) Then
SB.AppendLine(PropertyName)
Dim theMetrics As TabletPropertyMetrics = theTablet.GetPropertyMetrics(PropertyID)
SB.AppendLine(" Max: " + theMetrics.Maximum.ToString())
SB.AppendLine(" Min: " + theMetrics.Minimum.ToString())
SB.AppendLine(" Resolution: " + theMetrics.Resolution.ToString())
SB.AppendLine(" Units: " + theMetrics.Units.ToString())
Else
SB.AppendLine(PropertyName + " [not supported]")
End If
Return SB.ToString()
End Function
public string Report_PropertyMetrics_DefaultTablet()
{
StringBuilder SB = new StringBuilder(1024);
Tablet defTablet = new Tablets().DefaultTablet;
// Report on each of the property metrics for the default tablet
SB.AppendLine("Propert metrics of the default tablet: " + defTablet.Name);
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.AltitudeOrientation, "AltitudeOrientation"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.AzimuthOrientation, "AzimuthOrientation"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.ButtonPressure, "ButtonPressure"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.NormalPressure, "NormalPressure"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.PacketStatus, "PacketStatus"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.PitchRotation, "PitchRotation"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.RollRotation, "RollRotation"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.SerialNumber, "SerialNumber"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.TangentPressure, "TangentPressure"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.TimerTick, "TimerTick"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.TwistOrientation, "TwistOrientation"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.X, "X"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.XTiltOrientation, "XTiltOrientation"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.Y, "Y"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.YawRotation, "YawRotation"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.YTiltOrientation, "YTiltOrientation"));
SB.Append( GetPropertyMetrics(defTablet, PacketProperty.Z, "Z"));
return SB.ToString();
}
public string GetPropertyMetrics(Tablet theTablet, Guid PropertyID, string PropertyName)
{
StringBuilder SB = new StringBuilder(1024);
// If this particular property is supported,
// report the name and property metrics information.
if (theTablet.IsPacketPropertySupported(PropertyID))
{
SB.AppendLine(PropertyName);
TabletPropertyMetrics theMetrics = theTablet.GetPropertyMetrics(PropertyID);
SB.AppendLine(" Max: " + theMetrics.Maximum.ToString());
SB.AppendLine(" Min: " + theMetrics.Minimum.ToString());
SB.AppendLine(" Resolution: " + theMetrics.Resolution.ToString());
SB.AppendLine(" Units: " + theMetrics.Units.ToString());
}
else
{
SB.AppendLine(PropertyName + " [not supported]");
}
return SB.ToString();
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0
請參閱
參考
Stroke.GetPacketValuesByProperty