本文整理匯總了C#中System.Windows.Automation.Provider.IRangeValueProvider.SetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# IRangeValueProvider.SetValue方法的具體用法?C# IRangeValueProvider.SetValue怎麽用?C# IRangeValueProvider.SetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。
在下文中一共展示了IRangeValueProvider.SetValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SetValue
/// <summary>
/// Sets the value of the control.
/// </summary>
/// <param name="value">
/// The value to set the control to.
/// </param>
/// <remarks>
/// For the purposes of this sample, the custom control displays
/// its value through the alpha setting of its base color.
/// </remarks>
public void SetValue(double value)
{
if (value < Minimum | value > Maximum)
{
throw new ArgumentOutOfRangeException();
}
else
{
Color color = customControl.controlColor;
// Invoke control method on separate thread to avoid
// clashing with UI.
// Use anonymous method for simplicity.
this.customControl.Invoke(new MethodInvoker(delegate()
{
customControl.controlColor =
Color.FromArgb((int)value, color);
customControl.Refresh();
}));
}
}