本文整理汇总了C#中System.Windows.Media.SolidColorBrush.ChangeLightness方法的典型用法代码示例。如果您正苦于以下问题:C# SolidColorBrush.ChangeLightness方法的具体用法?C# SolidColorBrush.ChangeLightness怎么用?C# SolidColorBrush.ChangeLightness使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.SolidColorBrush
的用法示例。
在下文中一共展示了SolidColorBrush.ChangeLightness方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogYWindow_Loaded
//.........这里部分代码省略.........
X = DateTime.Now.AddYears(-20).AddDays(s),
Y = s / 2000.0
}
).ToList());
//edsLinear.SetXYMapping(s => new Point(xax.ConvertToDouble(s.X), s.Y));
edsLinear.SetXMapping(s => xAxis.ConvertToDouble(s.X));
edsLinear.SetYMapping(s => yAxis.ConvertToDouble(s.Y));
edsLinear.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, s => String.Format("Vol:{0}\r\nOn:{1}", s.Y, s.X.ToShortDateString()));
edsLog10 = new EnumerableDataSource<TPoint>(
Enumerable.Range(1, 2000).Select(s =>
new TPoint
{
X = DateTime.Now.AddYears(-20).AddDays(s),
Y = Math.Log10(s)
}
).Where(s => s.Y > 0).ToList());
//edsLog10.SetXYMapping(s => new Point(xax.ConvertToDouble(s.X), s.Y));
edsLog10.SetXMapping(s => xAxis.ConvertToDouble(s.X));
edsLog10.SetYMapping(s => yAxis.ConvertToDouble(s.Y));
edsLog10.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, s => String.Format("Vol:{0}\r\nOn:{1}", s.Y, s.X.ToShortDateString()));
SolidColorBrush brushPow = new SolidColorBrush(Colors.Green);
Pen linePenPow = new Pen(brushPow, 2.0);
CircleElementPointMarker markerPow = new CircleElementPointMarker
{
Size = 4,
Brush = brushPow,
Fill = brushPow
};
PenDescription descPow = new PenDescription("f(x) = 10 ^ x");
//var chartPow = plotter.AddLineGraph(edsPow, linePenPow, (ShapeElementPointMarker)null/*markerPow*/, descPow);
SolidColorBrush brushLinear = new SolidColorBrush(Colors.Blue);
Pen linePenLinear = new Pen(brushLinear, 2.0);
CircleElementPointMarker markerLinear = new CircleElementPointMarker
{
Size = 4,
Brush = brushLinear,
Fill = brushLinear
};
PenDescription descLinear = new PenDescription("f(x) = x");
//var chartLinear = plotter.AddLineGraph(edsLinear, linePenLinear, (ShapeElementPointMarker)null/*markerLinear*/, descLinear);
SolidColorBrush brushLog10 = new SolidColorBrush(Colors.Red);
Pen linePenLog10 = new Pen(brushLog10, 2.0);
CircleElementPointMarker markerLog10 = new CircleElementPointMarker
{
Size = 4,
Brush = brushLog10,
Fill = brushLog10
};
PenDescription descLog10 = new PenDescription("f(x) = log(x)");
var chartLog10 = plotter.AddLineGraph(edsLog10, linePenLog10, (ShapeElementPointMarker)null/*markerLog10*/, descLog10);
//plotter.Children.Add(new DataFollowChart(chartPow.LineGraph).WithProperty(c =>
//{
// c.Marker.SetValue(Shape.FillProperty, brushPow);
// c.Marker.SetValue(Shape.StrokeProperty, brushPow.MakeDarker(0.2));
//}));
//plotter.Children.Add(new DataFollowChart(chartLinear.LineGraph).WithProperty(c =>
//{
// c.Marker.SetValue(Shape.FillProperty, brushLinear);
// c.Marker.SetValue(Shape.StrokeProperty, brushLinear.MakeDarker(0.2));
//}));
plotter.Children.Add(new CursorCoordinateGraph());
ValueStore store = new ValueStore();
DataFollowChart dataFollowChart = new DataFollowChart(chartLog10.LineGraph);
dataFollowChart.Marker.SetValue(Shape.FillProperty, brushLog10);
dataFollowChart.Marker.SetValue(Shape.StrokeProperty, brushLog10.ChangeLightness(0.8));
dataFollowChart.MarkerPositionChanged += new EventHandler(dataFollowChart_MarkerPositionChanged);
//dataFollowChart.CustomDataContextCallback = () =>
// {
// if (dataFollowChart.ClosestPointIndex != -1)
// {
// var closestPoint = ((List<TPoint>)edsLog10.Data)[dataFollowChart.ClosestPointIndex];
// return store.SetValue("X", closestPoint.Y.ToString()).SetValue("Y", closestPoint.X.ToShortDateString());
// }
// else return null;
// };
#if true
dataFollowChart.MarkerTemplate = (DataTemplate)FindResource("followMarkerTemplate");
#else
dataFollowChart.MarkerAdjustCallback = marker =>
{
Ellipse ellipse = (Ellipse)marker;
var markerPosition = c.MarkerPosition;
var date = xAxis.ConvertFromDouble(markerPosition.X);
var y = yAxis.ConvertFromDouble(markerPosition.Y);
ellipse.ToolTip = String.Format("Vol:{0}\r\nOn:{1}", y, date.ToShortDateString());
};
#endif
plotter.Children.Add(dataFollowChart);
Content = plotter;
}