ScrollPattern.NoScroll 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
規定不得進行捲動。
public: double NoScroll = -1;
public const double NoScroll = -1;
val mutable NoScroll : double
Public Const NoScroll As Double = -1
欄位值
Value = -1範例
以下範例中, ScrollPattern 從 取得 AutomationElement 控制模式,然後用來將可查看區域捲動至內容區頂端。
///--------------------------------------------------------------------
/// <summary>
/// Obtains a ScrollPattern control pattern from an automation
/// element and attempts to scroll to the top of the
/// viewfinder.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
///--------------------------------------------------------------------
private void ScrollToTop(AutomationElement targetControl)
{
if (targetControl == null)
{
throw new ArgumentNullException(
"AutomationElement argument cannot be null.");
}
ScrollPattern scrollPattern = GetScrollPattern(targetControl);
try
{
scrollPattern.SetScrollPercent(ScrollPattern.NoScroll, 0);
}
catch (InvalidOperationException)
{
// Control not able to scroll in the direction requested;
// when scrollable property of that direction is False
// TO DO: error handling.
}
catch (ArgumentOutOfRangeException)
{
// A value greater than 100 or less than 0 is passed in
// (except -1 which is equivalent to NoScroll).
// TO DO: error handling.
}
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains a ScrollPattern control pattern from an automation
''' element and attempts to scroll to the top of the
''' viewfinder.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
'''--------------------------------------------------------------------
Private Sub ScrollToTop(ByVal targetControl As AutomationElement)
If targetControl Is Nothing Then
Throw New ArgumentNullException( _
"AutomationElement argument cannot be null.")
End If
Dim scrollPattern As ScrollPattern = GetScrollPattern(targetControl)
Try
scrollPattern.SetScrollPercent(ScrollPattern.NoScroll, 0)
Catch exc As InvalidOperationException
' Control not able to scroll in the direction requested;
' when scrollable property of that direction is False
' TO DO: error handling.
Catch exc As ArgumentOutOfRangeException
' A value greater than 100 or less than 0 is passed in
' (except -1 which is equivalent to NoScroll).
' TO DO: error handling.
End Try
End Sub
備註
此識別碼用於 使用者介面自動化 客戶端應用程式。 使用者介面自動化提供者應該使用ScrollPatternIdentifiers 中的等效欄位。
值 -1 可以替換成 NoScroll 場。