Bagikan melalui


ScrollPattern.ScrollPatternInformation.HorizontalScrollPercent Properti

Definisi

Mendapatkan posisi gulir horizontal saat ini.

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

Nilai Properti

Posisi gulir horizontal sebagai persentase dari total area konten dalam elemen Automation UI. Nilai defaultnya adalah 0,0.

Contoh

Dalam contoh berikut, objek yang ScrollPattern diperoleh dari kontrol target diteruskan ke fungsi yang mengambil persentase gulir horizontal dan vertikal saat ini dari wilayah yang dapat dilihat dalam area konten.

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

    double[] percentage = new double[2];

    percentage[0] =
        scrollPattern.Current.HorizontalScrollPercent;

    percentage[1] =
         scrollPattern.Current.VerticalScrollPercent;

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

    Dim percentage(1) As Double

    percentage(0) = scrollPattern.Current.HorizontalScrollPercent

    percentage(1) = scrollPattern.Current.VerticalScrollPercent

    Return percentage

End Function 'GetScrollPercentagesFromPattern

Berlaku untuk