Exemple #1
0
        public override PaintResult BeginPaint(PaintContext context, Point beginPoint)
        {
            if (context == null)
            {
                return(null);
            }

            if (_layers == null)
            {
                _layers = new List <LayerBase>();
            }
            else
            {
                _layers.Clear();
            }

            _paintContext = context;
            _geometry     = null;
            PaintResult result = new PaintResult();
            SimpleLayer layer  = new SimpleLayer();

            result.PaintLayerType = PaintLayerType.New;
            _geometry             = new Circle(new CircleStyle()
            {
                FirstPoint  = beginPoint,
                SecondPoint = beginPoint,
                LineBrush   = (context.PaintTool as CircleTool).LineBrush,
                FillBrush   = (context.PaintTool as CircleTool).FillBrush,
                LineWidth   = (context.PaintTool as CircleTool).LineWidth
            }, new CircleAction());

            layer.AddGeometry(_geometry);
            _layers.Add(layer);
            result.Layers = _layers;

            context.OperationLayers.Clear();
            _layers.ForEach(m => context.OperationLayers.Add(m));

            NotifyLayerGroup(context, result);

            return(result);
        }
Exemple #2
0
        public override PaintResult BeginPaint(PaintContext context, Point beginPoint)
        {
            if (context == null)
            {
                return(null);
            }

            if (_layers == null)
            {
                _layers = new List <LayerBase>();
            }
            else
            {
                _layers.Clear();
            }

            _paintContext = context;
            PaintResult result = new PaintResult();

            result.PaintLayerType = PaintLayerType.New;

            SimpleLayer layer = new SimpleLayer();

            _geometry = new Text(new TextStyle()
            {
                FirstPoint  = beginPoint,
                SecondPoint = beginPoint,
                Font        = (context.PaintTool as TextTool).Font,
                Foreground  = (context.PaintTool as TextTool).Foreground,
            }, new TextAction());

            layer.AddGeometry(_geometry);
            _layers.Add(layer);
            result.Layers = _layers;

            context.OperationLayers.Clear();
            _layers.ForEach(m => context.OperationLayers.Add(m));

            NotifyLayerGroup(context, result);

            return(result);
        }