RangeValuePattern.Pattern 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
識別 RangeValuePattern 控制項模式。
public: static initonly System::Windows::Automation::AutomationPattern ^ Pattern;
public static readonly System.Windows.Automation.AutomationPattern Pattern;
staticval mutable Pattern : System.Windows.Automation.AutomationPattern
Public Shared ReadOnly Pattern As AutomationPattern
欄位值
範例
在下列範例中, RangeValuePattern 會從 AutomationElement 取得控制項模式。
///--------------------------------------------------------------------
/// <summary>
/// Obtains a RangeValuePattern control pattern from an
/// automation element.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// A RangeValuePattern object.
/// </returns>
///--------------------------------------------------------------------
private RangeValuePattern GetRangeValuePattern(
AutomationElement targetControl)
{
RangeValuePattern rangeValuePattern = null;
try
{
rangeValuePattern =
targetControl.GetCurrentPattern(
RangeValuePattern.Pattern)
as RangeValuePattern;
}
// Object doesn't support the
// RangeValuePattern control pattern
catch (InvalidOperationException)
{
return null;
}
return rangeValuePattern;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains a RangeValuePattern control pattern from an
''' automation element.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' A RangeValuePattern object.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetRangeValuePattern( _
ByVal targetControl As AutomationElement) As RangeValuePattern
Dim rangeValuePattern As RangeValuePattern = Nothing
Try
rangeValuePattern = DirectCast( _
targetControl.GetCurrentPattern(rangeValuePattern.Pattern), _
RangeValuePattern)
Catch exc As InvalidOperationException
' Object doesn't support the
' RangeValuePattern control pattern
Return Nothing
End Try
Return rangeValuePattern
End Function 'GetRangeValuePattern
備註
消費者介面自動化用戶端應用程式會使用此識別碼。 消費者介面自動化提供者應該使用 中的 RangeValuePatternIdentifiers 對等欄位。
模式識別碼會傳遞至方法,例如 GetCurrentPattern ,從指定的 AutomationElement 擷取感興趣的控制項模式。