本文整理汇总了C#中ICanvas.Render方法的典型用法代码示例。如果您正苦于以下问题:C# ICanvas.Render方法的具体用法?C# ICanvas.Render怎么用?C# ICanvas.Render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICanvas
的用法示例。
在下文中一共展示了ICanvas.Render方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XLineEditor
public XLineEditor(
INativeConverter nativeConverter,
ICanvasFactory canvasFactory,
IBoundsFactory boundsFactory,
ICanvas canvas)
{
_canvas = canvas;
Name = "Line";
Key = "L";
Modifiers = "";
var moves = _canvas.Moves.Where(_ => _canvas.IsCaptured);
var drags = Observable.Merge(_canvas.Downs, _canvas.Ups, moves);
_downs = _canvas.Downs.Where(_ => IsEnabled).Subscribe(p =>
{
if (_canvas.IsCaptured)
{
//_xline.Point2.X = p.X;
//_xline.Point2.Y = p.Y;
//_nline.Point2 = _xline.Point2;
#if CONNECTORS
ConnectPoint2(p);
#endif
_nline.Bounds.Hide();
_canvas.Render(null);
_state = State.None;
_canvas.ReleaseCapture();
}
else
{
_xline = canvasFactory.CreateLine();
_xline.Point1.X = p.X;
_xline.Point1.Y = p.Y;
_xline.Point2.X = p.X;
_xline.Point2.Y = p.Y;
_nline = nativeConverter.Convert(_xline);
_canvas.History.Snapshot(_canvas);
#if CONNECTORS
ConnectPoint1(p);
#endif
_canvas.Add(_nline);
_nline.Bounds = boundsFactory.Create(_canvas, _nline);
_nline.Bounds.Update();
_nline.Bounds.Show();
_canvas.Capture();
_canvas.Render(null);
_state = State.End;
}
});
_drags = drags.Where(_ => IsEnabled).Subscribe(p =>
{
if (_state == State.End)
{
_xline.Point2.X = p.X;
_xline.Point2.Y = p.Y;
_nline.Point2 = _xline.Point2;
_nline.Bounds.Update();
_canvas.Render(null);
}
});
}
示例2: XBezierEditor
public XBezierEditor(
INativeConverter nativeConverter,
ICanvasFactory canvasFactory,
IBoundsFactory boundsFactory,
ICanvas canvas)
{
_canvas = canvas;
Name = "Bézier";
Key = "B";
Modifiers = "";
var moves = _canvas.Moves.Where(_ => _canvas.IsCaptured);
var drags = Observable.Merge(_canvas.Downs, _canvas.Ups, moves);
_downs = _canvas.Downs.Where(_ => IsEnabled).Subscribe(p =>
{
if (_canvas.IsCaptured)
{
switch (_state)
{
case State.Start:
{
//_xb.Point3.X = p.X;
//_xb.Point3.Y = p.Y;
//_nb.Point3 = _xb.Point3;
//_xb.Point2.X = p.X;
//_xb.Point2.Y = p.Y;
//_nb.Point2 = _xb.Point2;
#if CONNECTORS
ConnectPoint3(p);
#endif
_nb.Bounds.Update();
_canvas.Render(null);
_state = State.Point1;
}
break;
case State.Point1:
{
//_xb.Point1.X = p.X;
//_xb.Point1.Y = p.Y;
//_nb.Point1 = _xb.Point1;
#if CONNECTORS
ConnectPoint1(p);
#endif
_nb.Bounds.Update();
_canvas.Render(null);
_state = State.Point2;
}
break;
case State.Point2:
{
//_xb.Point2.X = p.X;
//_xb.Point2.Y = p.Y;
//_nb.Point2 = _xb.Point2;
#if CONNECTORS
ConnectPoint2(p);
#endif
_nb.Bounds.Hide();
_canvas.Render(null);
_state = State.None;
_canvas.ReleaseCapture();
}
break;
}
}
else
{
_xb = canvasFactory.CreateBezier();
_xb.Start.X = p.X;
_xb.Start.Y = p.Y;
_xb.Point1.X = p.X;
_xb.Point1.Y = p.Y;
_xb.Point2.X = p.X;
_xb.Point2.Y = p.Y;
_xb.Point3.X = p.X;
_xb.Point3.Y = p.Y;
_nb = nativeConverter.Convert(_xb);
_canvas.History.Snapshot(_canvas);
#if CONNECTORS
ConnectStart(p);
#endif
_canvas.Add(_nb);
_nb.Bounds = boundsFactory.Create(_canvas, _nb);
_nb.Bounds.Update();
_nb.Bounds.Show();
_canvas.Render(null);
_canvas.Capture();
_state = State.Start;
}
});
_drags = drags.Where(_ => IsEnabled).Subscribe(p =>
{
switch (_state)
{
case State.Start:
{
_xb.Point3.X = p.X;
_xb.Point3.Y = p.Y;
//.........这里部分代码省略.........
示例3: XPinEditor
public XPinEditor(
INativeConverter nativeConverter,
ICanvasFactory canvasFactory,
IBoundsFactory boundsFactory,
ICanvas canvas)
{
_canvas = canvas;
Name = "Pin";
Key = "P";
Modifiers = "";
var moves = _canvas.Moves.Where(_ => _canvas.IsCaptured);
var drags = Observable.Merge(_canvas.Downs, _canvas.Ups, moves);
_downs = _canvas.Downs.Where(_ => IsEnabled).Subscribe(p =>
{
_xpin = canvasFactory.CreatePin();
_xpin.Point.X = p.X;
_xpin.Point.Y = p.Y;
_npin = nativeConverter.Convert(_xpin);
_canvas.History.Snapshot(_canvas);
#if CONNECTORS
ConnectPoint(p);
#endif
_canvas.Add(_npin);
_npin.Bounds = boundsFactory.Create(_canvas, _npin);
_npin.Bounds.Update();
_canvas.Render(null);
});
}