RangeValuePattern.RangeValuePatternInformation.Value 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得消費者介面自動化專案的目前值。
public:
property double Value { double get(); };
public double Value { get; }
member this.Value : double
Public ReadOnly Property Value As Double
屬性值
消費者介面自動化專案的目前值,如果專案不支援 Value ,則 null
為 。 預設值為 0.0。
範例
在下列範例中, RangeValuePattern 從目標控制項取得的物件會傳遞至擷取目前 RangeValuePattern 屬性值的函式。
///--------------------------------------------------------------------
/// <summary>
/// Gets the current property values from target.
/// </summary>
/// <param name="rangeValuePattern">
/// A RangeValuePattern control pattern obtained from
/// an automation element representing a target control.
/// </param>
/// <param name="automationProperty">
/// The automation property of interest.
/// </param>
///--------------------------------------------------------------------
private object GetRangeValueProperty(
RangeValuePattern rangeValuePattern,
AutomationProperty automationProperty)
{
if (rangeValuePattern == null || automationProperty == null)
{
throw new ArgumentException("Argument cannot be null.");
}
if (automationProperty.Id ==
RangeValuePattern.MinimumProperty.Id)
{
return rangeValuePattern.Current.Minimum;
}
if (automationProperty.Id ==
RangeValuePattern.MaximumProperty.Id)
{
return rangeValuePattern.Current.Maximum;
}
if (automationProperty.Id ==
RangeValuePattern.SmallChangeProperty.Id)
{
return rangeValuePattern.Current.SmallChange;
}
if (automationProperty.Id ==
RangeValuePattern.LargeChangeProperty.Id)
{
return rangeValuePattern.Current.LargeChange;
}
if (automationProperty.Id ==
RangeValuePattern.ValueProperty.Id)
{
return rangeValuePattern.Current.Value;
}
return null;
}
'''--------------------------------------------------------------------
''' <summary>
''' Gets the current property values from target.
''' </summary>
''' <param name="rangeValuePattern">
''' A RangeValuePattern control pattern obtained from
''' an automation element representing a target control.
''' </param>
''' <param name="automationProperty">
''' The automation property of interest.
''' </param>
'''--------------------------------------------------------------------
Private Function GetRangeValueProperty( _
ByVal rangeValuePattern As RangeValuePattern, _
ByVal automationProperty As AutomationProperty) As Object
If (rangeValuePattern Is Nothing Or _
automationProperty Is Nothing) Then
Throw New ArgumentException("Argument cannot be null.")
End If
If automationProperty.Id = _
rangeValuePattern.MinimumProperty.Id Then
Return rangeValuePattern.Current.Minimum
End If
If automationProperty.Id = _
rangeValuePattern.MaximumProperty.Id Then
Return rangeValuePattern.Current.Maximum
End If
If automationProperty.Id = _
rangeValuePattern.SmallChangeProperty.Id Then
Return rangeValuePattern.Current.SmallChange
End If
If automationProperty.Id = _
rangeValuePattern.LargeChangeProperty.Id Then
Return rangeValuePattern.Current.LargeChange
End If
If automationProperty.Id = _
rangeValuePattern.ValueProperty.Id Then
Return rangeValuePattern.Current.Value
End If
Return Nothing
End Function 'GetRangeValueProperty