共用方式為


ScrollPattern.ScrollPatternInformation.HorizontalViewSize 屬性

定義

取得目前的水平檢視大小。

public:
 property double HorizontalViewSize { double get(); };
public double HorizontalViewSize { get; }
member this.HorizontalViewSize : double
Public ReadOnly Property HorizontalViewSize As Double

屬性值

可檢視區域的水平大小,為總計內容區域在使用者介面自動化項目中的百分比。 預設值為 100.0。

範例

在下列範例中, ScrollPattern 從目標控制項取得的物件會傳遞至函式,以擷取可檢視區域的目前垂直和水準大小,做為總內容區域的百分比。

///--------------------------------------------------------------------
/// <summary>
/// Obtains the current vertical and horizontal sizes of the viewable  
/// region as percentages of the total content area.
/// </summary>
/// <param name="scrollPattern">
/// The ScrollPattern control pattern obtained from the 
/// element of interest.
/// </param>
/// <returns>
/// The horizontal and vertical view sizes.
/// </returns>
///--------------------------------------------------------------------
private double[] GetViewSizes(ScrollPattern scrollPattern)
{
    if (scrollPattern == null)
    {
        throw new ArgumentNullException(
            "ScrollPattern argument cannot be null.");
    }

    double[] viewSizes = new double[2];

    viewSizes[0] =
        scrollPattern.Current.HorizontalViewSize;

    viewSizes[1] =
         scrollPattern.Current.VerticalViewSize;

    return viewSizes;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains the current vertical and horizontal sizes of the viewable  
''' region as percentages of the total content area.
''' </summary>
''' <param name="scrollPattern">
''' The ScrollPattern control pattern obtained from the 
''' element of interest.
''' </param>
''' <returns>
''' The horizontal and vertical view sizes.
''' </returns>
'''--------------------------------------------------------------------
Private Overloads Function GetViewSizes( _
ByVal scrollPattern As ScrollPattern) As Double()
    If scrollPattern Is Nothing Then
        Throw New ArgumentNullException( _
        "ScrollPattern argument cannot be null.")
    End If

    Dim viewSizes(1) As Double

    viewSizes(0) = scrollPattern.Current.HorizontalViewSize

    viewSizes(1) = scrollPattern.Current.VerticalViewSize

    Return viewSizes

End Function 'GetViewSizes

適用於