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 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(); }