ScrollPattern.ScrollPatternInformation.HorizontalScrollPercent Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u de huidige horizontale schuifpositie op.
public:
property double HorizontalScrollPercent { double get(); };
public double HorizontalScrollPercent { get; }
member this.HorizontalScrollPercent : double
Public ReadOnly Property HorizontalScrollPercent As Double
Waarde van eigenschap
De horizontale schuifpositie als een percentage van het totale inhoudsgebied binnen het UI Automation element. De standaardwaarde is 0,0.
Voorbeelden
In het volgende voorbeeld wordt een ScrollPattern object dat is verkregen uit een doelbesturing doorgegeven aan een functie waarmee de huidige horizontale en verticale schuifpercentages van de weergavebare regio in het inhoudsgebied worden opgehaald.
///--------------------------------------------------------------------
/// <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