Ejemplo n.º 1
0
        public ScrewHandleDrawing()
        {
            EllipseGeometry targetObject = new EllipseGeometry();

            targetObject.SetBinding(EllipseGeometry.RadiusXProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.EffectiveRadiusProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            targetObject.SetBinding(EllipseGeometry.RadiusYProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.EffectiveRadiusProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            this.screwGeometry.Children.Add(targetObject);
            LineGeometry geometry2 = new LineGeometry();

            geometry2.SetBinding <double, PointDouble>(LineGeometry.StartPointProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.EffectiveRadiusProperty.Name, Array.Empty <object>()), BindingMode.OneWay, r => new PointDouble(0.5 - r, 0.0));
            geometry2.SetBinding <double, PointDouble>(LineGeometry.EndPointProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.EffectiveRadiusProperty.Name, Array.Empty <object>()), BindingMode.OneWay, r => new PointDouble(r - 0.5, 0.0));
            this.screwGeometry.Children.Add(geometry2);
            LineGeometry geometry3 = new LineGeometry();

            geometry3.SetBinding <double, PointDouble>(LineGeometry.StartPointProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.EffectiveRadiusProperty.Name, Array.Empty <object>()), BindingMode.OneWay, r => new PointDouble(0.0, 0.5 - r));
            geometry3.SetBinding <double, PointDouble>(LineGeometry.EndPointProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.EffectiveRadiusProperty.Name, Array.Empty <object>()), BindingMode.OneWay, r => new PointDouble(0.0, r - 0.5));
            this.screwGeometry.Children.Add(geometry3);
            this.backgroundDrawing = new GeometryDrawing();
            this.backgroundPen     = new Pen();
            this.backgroundPen.SetBinding(Pen.ThicknessProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.ThicknessProperty.Name, Array.Empty <object>()), BindingMode.OneWay, t => ((double)t) + 2.5);
            this.backgroundPen.SetBinding(Pen.BrushProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.BackgroundProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            this.backgroundDrawing.Pen      = this.backgroundPen;
            this.backgroundDrawing.Geometry = this.screwGeometry;
            base.DrawingGroup.Children.Add(this.backgroundDrawing);
            this.foregroundDrawing = new GeometryDrawing();
            this.foregroundPen     = new Pen();
            this.foregroundPen.SetBinding(Pen.ThicknessProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.ThicknessProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            this.foregroundPen.SetBinding(Pen.BrushProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.ForegroundProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            this.foregroundDrawing.Pen      = this.foregroundPen;
            this.foregroundDrawing.Geometry = this.screwGeometry;
            base.DrawingGroup.Children.Add(this.foregroundDrawing);
        }