本文整理汇总了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();
}));
}
}