本文整理汇总了C#中Xwt.Drawing.Context.RelMoveTo方法的典型用法代码示例。如果您正苦于以下问题:C# Context.RelMoveTo方法的具体用法?C# Context.RelMoveTo怎么用?C# Context.RelMoveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xwt.Drawing.Context
的用法示例。
在下文中一共展示了Context.RelMoveTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawPopover
void DrawPopover(Context ctx)
{
lock (trackerLock)
{
if (actualTrackerHitResult != null)
{
var trackerSettings = DefaultTrackerSettings;
if (actualTrackerHitResult.Series != null && !string.IsNullOrEmpty(actualTrackerHitResult.Series.TrackerKey))
trackerSettings = trackerDefinitions[actualTrackerHitResult.Series.TrackerKey];
if (trackerSettings.Enabled)
{
var extents = actualTrackerHitResult.LineExtents;
if (Math.Abs(extents.Width) < double.Epsilon)
{
extents = new OxyRect(actualTrackerHitResult.XAxis.ScreenMin.X, extents.Top, actualTrackerHitResult.XAxis.ScreenMax.X - actualTrackerHitResult.XAxis.ScreenMin.X, extents.Height);
}
if (Math.Abs(extents.Height) < double.Epsilon)
{
extents = new OxyRect(extents.Left, actualTrackerHitResult.YAxis.ScreenMin.Y, extents.Width, actualTrackerHitResult.YAxis.ScreenMax.Y - actualTrackerHitResult.YAxis.ScreenMin.Y);
}
var pos = actualTrackerHitResult.Position;
if (trackerSettings.HorizontalLineVisible)
{
renderContext.DrawLine(
new[] { new ScreenPoint(extents.Left, pos.Y), new ScreenPoint(extents.Right, pos.Y) },
trackerSettings.HorizontalLineColor,
trackerSettings.HorizontalLineWidth,
trackerSettings.HorizontalLineActualDashArray,
LineJoin.Miter,
true);
}
if (trackerSettings.VerticalLineVisible)
{
renderContext.DrawLine(
new[] { new ScreenPoint(pos.X, extents.Top), new ScreenPoint(pos.X, extents.Bottom) },
trackerSettings.VerticalLineColor,
trackerSettings.VerticalLineWidth,
trackerSettings.VerticalLineActualDashArray,
LineJoin.Miter,
true);
}
TextLayout text = new TextLayout();
text.Font = trackerSettings.Font;
text.Text = actualTrackerHitResult.Text;
var arrowTop = actualTrackerHitResult.Position.Y <= Bounds.Height / 2;
const int arrowPadding = 10;
var textSize = text.GetSize();
var outerSize = new Size(textSize.Width + (trackerSettings.Padding * 2),
textSize.Height + (trackerSettings.Padding * 2) + arrowPadding);
var trackerBounds = new Rectangle(pos.X - (outerSize.Width / 2),
0,
outerSize.Width,
outerSize.Height - arrowPadding);
if (arrowTop)
trackerBounds.Y = pos.Y + arrowPadding + trackerSettings.BorderWidth;
else
trackerBounds.Y = pos.Y - outerSize.Height - trackerSettings.BorderWidth;
var borderColor = trackerSettings.BorderColor.ToXwtColor();
ctx.RoundRectangle(trackerBounds, 6);
ctx.SetLineWidth(trackerSettings.BorderWidth);
ctx.SetColor(borderColor);
ctx.StrokePreserve();
ctx.SetColor(trackerSettings.Background.ToXwtColor());
ctx.Fill();
ctx.Save();
var arrowX = trackerBounds.Center.X;
var arrowY = arrowTop ? trackerBounds.Top : trackerBounds.Bottom;
ctx.NewPath();
ctx.MoveTo(arrowX, arrowY);
var triangleSide = 2 * arrowPadding / Math.Sqrt(3);
var halfSide = triangleSide / 2;
var verticalModifier = arrowTop ? -1 : 1;
ctx.RelMoveTo(-halfSide, 0);
ctx.RelLineTo(halfSide, verticalModifier * arrowPadding);
ctx.RelLineTo(halfSide, verticalModifier * -arrowPadding);
ctx.SetColor(borderColor);
ctx.StrokePreserve();
ctx.ClosePath();
ctx.SetColor(trackerSettings.Background.ToXwtColor());
ctx.Fill();
ctx.Restore();
ctx.SetColor(trackerSettings.TextColor.ToXwtColor());
ctx.DrawTextLayout(text,
trackerBounds.Left + trackerSettings.Padding,
trackerBounds.Top + trackerSettings.Padding);
}
}
}
//.........这里部分代码省略.........