本文整理汇总了C#中System.Windows.Ink.Stroke类的典型用法代码示例。如果您正苦于以下问题:C# Stroke类的具体用法?C# Stroke怎么用?C# Stroke使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Stroke类属于System.Windows.Ink命名空间,在下文中一共展示了Stroke类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MyIP_MouseLeftButtonDown
//A new stroke object named MyStroke is created. MyStroke is added to the StrokeCollection of the InkPresenter named MyIP
private void MyIP_MouseLeftButtonDown(object sender, MouseEventArgs e)
{
MyIP.CaptureMouse();
if (eraseflag == true)
{
StylusPointCollection MyStylusPointCollection = new StylusPointCollection();
MyStylusPointCollection.Add(e.StylusDevice.GetStylusPoints(MyIP));
NewStroke = new Stroke(MyStylusPointCollection);
NewStroke.DrawingAttributes.Color = Colors.Red;
MyIP.Strokes.Add(NewStroke); StylusPointCollection ErasePointCollection = new StylusPointCollection();
}
else
{
StylusPointCollection pointErasePoints = e.StylusDevice.GetStylusPoints(MyIP);
StrokeCollection hitStrokes = MyIP.Strokes.HitTest(pointErasePoints);
if (hitStrokes.Count > 0)
{
foreach (Stroke hitStroke in hitStrokes)
{
MyIP.Strokes.Remove(hitStroke);
//undoStack.Push(hitStroke);
//undoStateBufferStack.Push(true);
}
}
}
}
示例2: signaturePad_MouseLeftButtonDown
private void signaturePad_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
signaturePad.CaptureMouse();
_currentStroke = new Stroke();
_currentStroke.StylusPoints.Add(GetStylusPoint(e.GetPosition(signaturePad)));
_currentStroke.DrawingAttributes.Color = Colors.Blue;
signaturePad.Strokes.Add(_currentStroke);
}
示例3: TouchPoint2
public TouchPoint2(TouchInfo info, UIElement source, StylusPointCollection stylusPoints)
{
this.Source = source;
Stroke = new Stroke(stylusPoints);
TouchDeviceId = info.TouchDeviceId;
StartTime = DateTime.Now;
UpdateTouchInfo(info);
}
示例4: Stroke_Default_Bounds
public void Stroke_Default_Bounds ()
{
Stroke s = new Stroke ();
Rect bounds = s.GetBounds ();
Assert.AreEqual (-1.5, bounds.Top, "Top");
Assert.AreEqual (-1.5, bounds.Left, "Left");
Assert.AreEqual (3, bounds.Height, "Height");
Assert.AreEqual (3, bounds.Width, "Width");
}
示例5: Graph
public Graph(IDelegate _del, Stroke b)
{
del = _del;
box = b;
bounds = box.GetBounds();
box.StylusPoints = InkUtils.xkcd(InkUtils.box(bounds));
box.DrawingAttributes.Color = Colors.Blue;
analyzer = new InkAnalyzer();
analyzer.ContextNodeCreated += ContextNodeCreated;
}
示例6: Stroke_Default
public void Stroke_Default ()
{
Stroke s = new Stroke ();
Assert.AreEqual (0, s.StylusPoints.Count, "StylusPoints");
Assert.Throws<ArgumentException> (delegate {
s.HitTest (null);
}, "HitTest-null");
Assert.IsFalse (s.HitTest (s.StylusPoints), "HitTest-StylusPoints");
}
示例7: ipMouseLeftButtonDown
public void ipMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
myInkPresenter.CaptureMouse();
_stroke = new Stroke(e.StylusDevice.GetStylusPoints(myInkPresenter))
{
DrawingAttributes = {Color = Colors.Blue,
OutlineColor = Colors.White},
};
myInkPresenter.Strokes.Add(_stroke);
}
示例8: myInkPresenter_MouseLeftButtonDown
private void myInkPresenter_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
//捕获鼠标焦点
myInkPresenter.CaptureMouse();
myPointCollection = new StylusPointCollection();
myPointCollection.Add(e.StylusDevice.GetStylusPoints(myInkPresenter));
currentStroke = new Stroke(myPointCollection);
//设置画笔属性
currentStroke.DrawingAttributes.Color = currentColor;
currentStroke.DrawingAttributes.Height = sliderThickness.Value;
currentStroke.DrawingAttributes.Width = sliderThickness.Value;
myInkPresenter.Strokes.Add(currentStroke);
}
示例9: annotoPenReceiver_PenUp
void annotoPenReceiver_PenUp(object sender, AnnotoPenMotionEventArgs e)
{
Dispatcher.BeginInvoke((Action)delegate()
{
/*if (currentPts == null || currentPts.Count == 0)
{
return;
}
inkCanvas.Strokes.Add(new Stroke(currentPts));
currentPts = new StylusPointCollection();*/
currentStroke = null;
Trace.WriteLine("Pen Up");
}, null);
}
示例10: StrokeToString
private string StrokeToString(Stroke stroke)
{
var strokestring = "<stroke>";
strokestring += "<color>" + stroke.DrawingAttributes.Color.ToString() + "</color>";
strokestring += "<size>" + stroke.DrawingAttributes.Height.ToString() + "</size>";
strokestring += "<creator>" + me + "</creator>";
strokestring += "<points>";
foreach (StylusPoint sp in stroke.StylusPoints)
{
strokestring += sp.X + "," + sp.Y + "," + sp.PressureFactor + " ";
}
strokestring.TrimEnd(new char[] { ' ' });
strokestring += "</points>";
strokestring += "</stroke>";
return strokestring;
}
示例11: GetIterator
/// <summary>
/// Helper wrapper
/// </summary>
internal static StrokeNodeIterator GetIterator(Stroke stroke, DrawingAttributes drawingAttributes)
{
if (stroke == null)
{
throw new System.ArgumentNullException("stroke");
}
if (drawingAttributes == null)
{
throw new System.ArgumentNullException("drawingAttributes");
}
StylusPointCollection stylusPoints =
drawingAttributes.FitToCurve ? stroke.GetBezierStylusPoints() : stroke.StylusPoints;
return GetIterator(stylusPoints, drawingAttributes);
}
示例12: process
public void process(InkAnalyzer inkAnalyzer)
{
ContextNodeCollection nodeCollection = inkAnalyzer.FindLeafNodes();
foreach (ContextNode childNodes in nodeCollection)
{
foreach (Stroke stroke in childNodes.Strokes)
{
if (strokeIsCaret(stroke))
{
insertionBox.Visibility = Visibility.Visible;
Canvas.SetLeft(insertionBox, stroke.StylusPoints[0].X - 140);
Canvas.SetTop(insertionBox, stroke.StylusPoints[1].Y);
inkAnalyzer.RemoveStroke(stroke);
strokeToBeReplaced = stroke;
}
}
}
}
示例13: Update
protected void Update( object sender, EventArgs e )
{
paintCanvas.Strokes.Clear();
windowWidth = (float)this.Width;
windowHeight = (float)this.Height;
Leap.Frame frame = leap.Frame();
InteractionBox interactionBox = leap.Frame().InteractionBox;
foreach ( Pointable pointable in leap.Frame().Pointables ) {
// ここから追加
// 伸びている指、ツール以外は無視する
//if ( !pointable.IsExtended ) {
// continue;
//}
// ここまで追加
Leap.Vector normalizedPosition =
interactionBox.NormalizePoint( pointable.StabilizedTipPosition );
float tx = normalizedPosition.x * windowWidth;
float ty = windowHeight - normalizedPosition.y * windowHeight;
int alpha = 255;
if ( (pointable.TouchDistance > 0 && pointable.TouchZone != Pointable.Zone.ZONENONE ) ) {
alpha = 255 - (int)(255 * pointable.TouchDistance);
touchIndicator.Color = Color.FromArgb( (byte)alpha, 0x0, 0xff, 0x0 );
}
else if ( pointable.TouchDistance <= 0 ) {
alpha = -(int)(255 * pointable.TouchDistance);
touchIndicator.Color = Color.FromArgb( (byte)alpha, 0xff, 0x0, 0x0 );
}
else {
alpha = 50;
touchIndicator.Color = Color.FromArgb( (byte)alpha, 0x0, 0x0, 0xff );
}
StylusPoint touchPoint = new StylusPoint( tx, ty );
StylusPointCollection tips =
new StylusPointCollection( new StylusPoint[] { touchPoint } );
Stroke touchStroke = new Stroke( tips, touchIndicator );
paintCanvas.Strokes.Add( touchStroke );
}
}
示例14: Stroke_StylusPointCollection
public void Stroke_StylusPointCollection ()
{
StylusPointCollection spc = new StylusPointCollection ();
spc.Add (new StylusPoint (1, 2));
Stroke s = new Stroke (spc);
Assert.AreEqual (1, s.StylusPoints.Count, "StylusPoints-1");
spc.Add (new StylusPoint (3, 4));
Assert.AreEqual (2, s.StylusPoints.Count, "StylusPoints-2");
s.StylusPoints.Add (new StylusPoint (5, 6));
Assert.AreEqual (3, s.StylusPoints.Count, "StylusPoints-3a");
Assert.AreEqual (3, spc.Count, "StylusPoints-3b");
Assert.Throws<ArgumentException> (delegate {
s.HitTest (null);
}, "HitTest-null");
Assert.IsTrue (s.HitTest (s.StylusPoints), "HitTest-StylusPoints");
}
示例15: StrokeVisual
/// <summary>
/// Constructor
/// </summary>
/// <param name="stroke">a stroke to render into this visual</param>
/// <param name="renderer">a renderer associated to this visual</param>
internal StrokeVisual(Stroke stroke, Renderer renderer) : base()
{
Debug.Assert(renderer != null);
if (stroke == null)
{
throw new System.ArgumentNullException("stroke");
}
_stroke = stroke;
_renderer = renderer;
// The original value of the color and IsHighlighter are cached so
// when Stroke.Invalidated is fired, Renderer knows whether re-arranging
// the visual tree is needed.
_cachedColor = stroke.DrawingAttributes.Color;
_cachedIsHighlighter = stroke.DrawingAttributes.IsHighlighter;
// Update the visual contents
Update();
}