本文整理汇总了C#中System.Windows.Ink.Stroke.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Stroke.Clone方法的具体用法?C# Stroke.Clone怎么用?C# Stroke.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Ink.Stroke
的用法示例。
在下文中一共展示了Stroke.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: newStroke
/// <summary>
/// Analyze a new stroke.
/// </summary>
/// <param name="stroke"></param>
/// <returns>true if the stroke was recognized as belonging to a graph (and so should be excluded from InkAnalyzer)</returns>
public bool newStroke(Stroke stroke)
{
if (strokes.ContainsKey(stroke))
{
// already have it!
return true;
}
foreach (Graph g in graphs)
{
if (g.containsStroke(stroke) && g.takeStroke(stroke))
{
strokes.Add(stroke, g);
return true;
}
}
Stroke copy = stroke.Clone();
analyzer.AddStroke(copy);
analyzer.Analyze();
StrokeCollection sc = new StrokeCollection(new Stroke[] { copy });
ContextNodeCollection ctxNodes = analyzer.FindInkLeafNodes(sc);
foreach (ContextNode ctxNode in ctxNodes)
{
if (ctxNode is InkDrawingNode && (ctxNode as InkDrawingNode).GetShapeName() == "Rectangle")
{
Graph g = new XYGraph(this, stroke);
graphs.Add(g);
strokes.Add(stroke, g);
analyzer.RemoveStroke(copy);
return true;
}
}
analyzer.RemoveStroke(copy);
return false;
}
示例2: doMyStrokeAdded
public void doMyStrokeAdded(Stroke stroke, string intendedPrivacy)
{
doMyStrokeAddedExceptHistory(stroke, intendedPrivacy);
var thisStroke = stroke.Clone();
UndoHistory.Queue(
() =>
{
ClearAdorners();
var existingStroke = Strokes.Where(s => s.sum().checksum == thisStroke.sum().checksum).FirstOrDefault();
if (existingStroke != null)
{
Strokes.Remove(existingStroke);
doMyStrokeRemovedExceptHistory(existingStroke);
}
},
() =>
{
ClearAdorners();
if (Strokes.Where(s => s.sum().checksum == thisStroke.sum().checksum).Count() == 0)
{
Strokes.Add(thisStroke);
doMyStrokeAddedExceptHistory(thisStroke, thisStroke.tag().privacy);
}
if(EditingMode == InkCanvasEditingMode.Select)
Select(new StrokeCollection(new [] {thisStroke}));
addAdorners();
});
}
示例3: DrawLeapTouch
protected void DrawLeapTouch(Leap.Frame frame)
{
InteractionBox interactionBox = frame.InteractionBox;
if (frame.Pointables.Extended().Count != 1)
{
return;
}
Pointable pointable = frame.Pointables.Extended()[0];
// InteractionBox を利用した座標変換
Leap.Vector normalizedPosition = interactionBox.NormalizePoint(pointable.StabilizedTipPosition);
double tx = normalizedPosition.x * windowWidth;
double ty = windowHeight - normalizedPosition.y * windowHeight;
StylusPoint touchPoint = new StylusPoint(tx, ty);
StylusPointCollection tips = new StylusPointCollection(new StylusPoint[] { touchPoint });
// タッチ状態
if (normalizedPosition.z <= TouchBorder)
{
Stroke touchStroke = new Stroke(tips, touchIndicator);
this.InkCanvas_LeapPaintLine.Strokes.Add(touchStroke.Clone());
}
}