ScrollPattern.ScrollPatternInformation.HorizontalViewSize Property

 

Gets the current horizontal view size.

Namespace:   System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

public double HorizontalViewSize { get; }

Property Value

Type: System.Double

The horizontal size of the viewable region as a percentage of the total content area within the UI Automation element. The default value is 100.0.

In the following example, a ScrollPattern object obtained from a target control is passed into a function that retrieves the current vertical and horizontal sizes of the viewable region as percentages of the total content area.

///--------------------------------------------------------------------
/// <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;
}

.NET Framework
Available since 3.0
Return to top
Show: