public InkStrokeConverterArgs(GraphicsRectSizeBase graphics, InkCanvas canvas, InkStrokeBuilder strokeBuilder) { Graphics = graphics; Canvas = canvas; StrokeBuilder = strokeBuilder; PenAttribute = new InkDrawingAttributes(); }
private void PointerPressed(InkPoint point, PointerPoint pointer) { TmpRectGra = (GraphicsRectSizeBase)GraphicsInstCreateManager.CreateGraphics(Drawer.PenType, Drawer.LocPenModel, Drawer, InkCanvasSharp); Drawer.GraphicsRects.Add(TmpRectGra); TmpRectGra.BeginDraw(point, pointer); //TmpRectGra.PenAttribute.SetLinerPoints(TmpRectGra.Bounds); TmpRectGra.IsFill = Drawer.IsFill; Drawer.HistoriesManager.PushHistory(new CreateGraphicsHistory(Drawer, TmpRectGra)); Drawer.LocPenModel = Drawer.LocPenModel.Copy(); /* * if (TmpRectGra is GraphicsTextModel) * { * var tm = (TmpRectGra as GraphicsTextModel); * tm.Text = Drawer.Text; * tm.TextFormat = Drawer.TextFormat; * * var ctf = new CanvasTextFormat(); * var propdic = new Dictionary<string, PropertyInfo>(); * foreach (var item in ctf.GetType().GetProperties()) * { * propdic.Add(item.Name, item); * } * Drawer.TextFormat.GetType().GetProperties().ToList().ForEach(prop =>propdic[prop.Name].SetValue(ctf, prop.GetValue(Drawer.TextFormat))); * * //?????? * Drawer.TextFormat = new CanvasTextFormat() { FontSize=Drawer.TextFormat.FontSize}; * } */ }
private Rect GetBounds(GraphicsRectSizeBase graphicsRectSize) { Debug.Assert(graphicsRectSize.Points.Count > 0); var p1 = graphicsRectSize.Points[0]; var p2 = graphicsRectSize.Points[graphicsRectSize.Points.Count - 1]; return(new Rect(p1.Position, p2.Position)); }
private void PointerPressed(InkPoint point, PointerPoint p) { Drawer.LocPenModel.SetSolidColorBrush(Colors.White);//可以为背景颜色 TmpRectGra = (GraphicsRectSizeBase)GraphicsInstCreateManager.CreateGraphics(GraphicsTypes.CurveLine, Drawer.LocPenModel, Drawer, InkCanvasSharp); TmpRectGra.IsLock = true; Drawer.GraphicsRects.Add(TmpRectGra); TmpRectGra.BeginDraw(point, p); Drawer.HistoriesManager.PushHistory(new CreateGraphicsHistory(Drawer, TmpRectGra)); Drawer.LocPenModel = Drawer.LocPenModel.Copy(); }