本文整理汇总了C#中System.Windows.Media.DrawingContext.PushEffect方法的典型用法代码示例。如果您正苦于以下问题:C# DrawingContext.PushEffect方法的具体用法?C# DrawingContext.PushEffect怎么用?C# DrawingContext.PushEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.DrawingContext
的用法示例。
在下文中一共展示了DrawingContext.PushEffect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRender
protected override void OnRender(DrawingContext dc)
{
dc.DrawRectangle(Brushes.Transparent, null, new Rect(0, 0, RenderSize.Width, RenderSize.Height));
if (_currentPoint == null) return;
if (_lines == null || 0 == _lines.Count) return;
var count = _lines.Count;
var mouse = _currentPoint.Value;
_valueIndex = GetCurrentIndex(mouse);
if (_valueIndex < 0) return;
if (_pen == null)
{
_pen = this.GetDashPen(Brushes.DarkGray);
_pen.Freeze();
}
var height = RenderSize.Height - 20; // 20 上方日期占位
var values = new Dictionary<double, string>();
for (var i = 0; i < count; i++)
{
if (_lines[i].SaftyGetProperty<bool, ISelectable>(l => l.IsSelected != true))
continue;
var value = CalibrateValue(_lines[i].Values[_valueIndex]);
if (value == 0) continue;
if (values.ContainsKey(value))
continue;
var y = CalibrateAxisY(value, height);
values[value] = string.Format(_lines[i].Format, value);
values[value].ToFormattedText(Brushes.Black).Self(fTxt =>
{
fTxt.SetFontSize(10);
dc.PushEffect(_effect, null);
dc.DrawText(fTxt, new Point(mouse.X + 3, height - y));
dc.Pop();
});
}
if (values.Count == 0) return;
//mouse.X + .5 校正
dc.DrawLine(_pen, new Point(mouse.X + .5, 0), new Point(mouse.X + .5, this.RenderSize.Height));
_pointDateTime.ToString("hh:mm").ToFormattedText(Brushes.Black).Self(fTxt =>
{
dc.DrawText(fTxt, new Point(mouse.X - 32, RenderSize.Height - 18));
});
}