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. :)
Asked
Active
Viewed 313 times
1 Answers
0
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;
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
Then the Background
of the plotter
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);
};
Brightness of Map
a. Set a dark background for plotter
plotter.Background = new SolidColorBrush(Colors.Black);
b. Hide the grid
plotter.AxisGrid.Visibility = System.Windows.Visibility.Collapsed;
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);
}

kennyzx
- 12,845
- 6
- 39
- 83
-
I't doesnt work on the map, I't work only on a simple chart. I'm adding for you Screenshot from my application with facrot = 0.6 ... http://sizmedia.com/my.php?i=3mugmdn5r2ku.png – RonYamin Oct 19 '14 at 06:42
-
yes...the map is opaqued, so it is not affected by the plotter's background. I think you can add a semi-transparent gray layer on top of the map, the mouse can click through the layer to interact with the map, but that's too much work, and why do you want to dim the map? isn't it a monitor/projector setting? – kennyzx Oct 19 '14 at 14:29
-
I need to controll to brightness by slider, that's my job in the scholl, I would by thankfull if you could help me. Thanks. – RonYamin Oct 20 '14 at 09:07
-
Try this: Set the map's Opacity value as the value of `newFactor` in the slider's `ValueChanged` event handler. – kennyzx Oct 20 '14 at 09:37
-
Dude now it's work's but with 1 problem. It paint all the plotter. I want to paint in black only the map that on the plotter. See the result :http://sizmedia.com/my.php?i=5mqmwoju5zmz.png ..... http://sizmedia.com/my.php?i=lmym2mmmdjhz.png ... The result I want is that : http://sizmedia.com/my.php?i=zyzgnwmmkjdk.png , The diffrence is that I can see the Tick(Scale marks) – RonYamin Oct 26 '14 at 12:58
-
put a black canvas (something that has a background color, set it as black) beneath the map, it has the same size, and placed at exactly the same place as the map, use it as a background. leave the plotter's background as default. – kennyzx Oct 26 '14 at 13:05
-
How to put canvas exactly at the map position on chart ? Would you help me please ? :) – RonYamin Oct 26 '14 at 13:14
-
I tried to put canvas, now if I put the canvas **on** the map i can't click on the map it's like a layer that blocked the map. And if the canvas behind the plotter I cant see this. There is no option to set between the plotter and the map ? What to do ? Please help me – RonYamin Oct 26 '14 at 13:46
-
i don'no, if you first add something to the plotter, and then add the map to the plotter, then it _should_ be between the plotter and the map. i can't try it now. no dev environment – kennyzx Oct 26 '14 at 14:13
-
Ok, I'll wait until you can try it. I don't success to do it alone. Thank's any way. <3 – RonYamin Oct 26 '14 at 16:28
-
I tried but without luck, I thought I could add a WPF Canvas or something to the plotter, but it is not the way I thought...sorry pal, could not help you with this – kennyzx Oct 28 '14 at 06:15