ScrollPattern.ScrollPatternInformation.HorizontalViewSize 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取当前的水平视图大小。
public:
property double HorizontalViewSize { double get(); };
public double HorizontalViewSize { get; }
member this.HorizontalViewSize : double
Public ReadOnly Property HorizontalViewSize As Double
属性值
可视区域的水平大小,以 UI 自动化元素内整个内容区域的百分比表示。 默认值为 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