ScrollPattern.HorizontalViewSizeProperty 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
識別 HorizontalViewSize 屬性。
public: static initonly System::Windows::Automation::AutomationProperty ^ HorizontalViewSizeProperty;
public static readonly System.Windows.Automation.AutomationProperty HorizontalViewSizeProperty;
staticval mutable HorizontalViewSizeProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly HorizontalViewSizeProperty As AutomationProperty
欄位值
範例
在下列範例中,根項目會傳遞至函式,以傳回可檢視區域目前垂直和水準大小的函式,做為總內容區域的百分比。
///--------------------------------------------------------------------
/// <summary>
/// Obtains the current vertical and horizontal sizes of the viewable
/// region as percentages of the total content area.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// The horizontal and vertical view sizes.
/// </returns>
///--------------------------------------------------------------------
private double[] GetViewSizes(AutomationElement targetControl)
{
if (targetControl == null)
{
throw new ArgumentNullException(
"AutomationElement argument cannot be null.");
}
double[] viewSizes = new double[2];
viewSizes[0] =
(double)targetControl.GetCurrentPropertyValue(
ScrollPattern.HorizontalViewSizeProperty);
viewSizes[1] =
(double)targetControl.GetCurrentPropertyValue(
ScrollPattern.VerticalViewSizeProperty);
return viewSizes;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains the current vertical and horizontal sizes of the viewable
''' region as percentages of the total content area.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' The horizontal and vertical view sizes.
''' </returns>
'''--------------------------------------------------------------------
Private Overloads Function GetViewSizes( _
ByVal targetControl As AutomationElement) As Double()
If targetControl Is Nothing Then
Throw New ArgumentNullException( _
"AutomationElement argument cannot be null.")
End If
Dim viewSizes(1) As Double
viewSizes(0) = System.Convert.ToDouble( _
targetControl.GetCurrentPropertyValue( _
ScrollPattern.HorizontalViewSizeProperty))
viewSizes(1) = System.Convert.ToDouble( _
targetControl.GetCurrentPropertyValue( _
ScrollPattern.VerticalViewSizeProperty))
Return viewSizes
End Function 'GetViewSizes
備註
消費者介面自動化用戶端應用程式會使用此識別碼。 消費者介面自動化提供者應該使用 中的 ScrollPatternIdentifiers 對等欄位。