图表绘图仪的亮度(动态数据显示)C# [英] Brightness of chartplotter (Dynamic Data Display) C#

查看:228
本文介绍了图表绘图仪的亮度(动态数据显示)C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Microsoft Visual Studio 2010,包括参考动态数据显示。
我想制作一个控制地图亮度的滚动条。
我试图找到像亮度或类似的东西,但没有成功的属性。谢谢帮帮朋友:

I'm using Microsoft Visual Studio 2010, including reference Dynamic Data Display. I'm want to make an scroll bar that control of the brightness of the map . I'm tried to find a property like brightness or something like it but without a success. Thank for help friends. :)

推荐答案

您可以通过设置背景到不同的RGB值。每个值的范围从0(最暗)到255(最亮)。首先设置最亮的颜色,例如

You can control the brightness of the plotter by setting its Background to different RGB values. Each value has a range from 0 (Darkest) to 255 (Brightest). First set a brightest color, for example

Byte R = 255;
Byte G = 255;
Byte B = 255;

并定义一个因子(范围从 0.5 (0.0)是全黑色,所以我将下限设置为 0.5 ,它是灰色的。)

And define a factor (range from 0.5 to 1.0) that is controlled by the slider.(0.0 is total blackness, so I set the lower range as 0.5 which is gray).

double minFactor = 0.5;
double maxFactor = 1.0;
double factor = maxFactor; //initially, brightest

然后背景的绘图仪

Color color = Color.FromRgb((Byte)(factor*R), (Byte)(factor*G), (Byte)(factor*B));
plotter.Background = new SolidColorBrush(color);

这是滑块如何控制亮度。

And this is how the slider controls the brightness.

Slider slider = new Slider();
slider.Value = factor;
slider.Maximum = maxFactor;
slider.Minimum = minFactor;
slider.ValueChanged += (s, e) =>
{
    var newFactor = e.NewValue;
    Color newColor = Color.FromRgb((Byte)(newFactor * R), (Byte)(newFactor * G), (Byte)(newFactor * B));
    plotter.Background = new SolidColorBrush(newColor);
};

地图亮度

a。为绘图仪设置黑色背景

a. Set a dark background for plotter

plotter.Background = new SolidColorBrush(Colors.Black);

b。隐藏网格

plotter.AxisGrid.Visibility = System.Windows.Visibility.Collapsed;

c。通过滑块调整地图的不透明度

c. Adjust map's Opacity by slider

slider.ValueChanged += (s, e) =>
{
    var newFactor = e.NewValue;
    map.Opacity = newFactor;
    //Color newColor = Color.FromRgb((Byte)(newFactor * R), (Byte)(newFactor * G), (Byte)(newFactor * B));
    //plotter.Background = new SolidColorBrush(newColor);
}

这篇关于图表绘图仪的亮度(动态数据显示)C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆