public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			double thickness = (double) value;
			DrawingAttributes attr = new DrawingAttributes
			                         	{Width = thickness, Height = thickness, FitToCurve = false, Color = Colors.White};
			return attr;
		}
Пример #2
0
        public override void OnMouseMove(InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                endPoint = e.GetPosition(inkCanvas);

                if (startPoint != endPoint)
                {
                    StylusPointCollection pts = new StylusPointCollection();
                    GetLine(pts, (s) =>
                    {
                        if (StrokeResult != null)
                            inkCanvas.Strokes.Remove(StrokeResult);

                        DrawingAttributes drawingAttributes = new DrawingAttributes
                        {
                            Color = inkCanvas.DefaultDrawingAttributes.Color,
                            Width = inkCanvas.DefaultDrawingAttributes.Width,
                            StylusTip = StylusTip.Ellipse,
                            IgnorePressure = true,
                            FitToCurve = true
                        };

                        StrokeResult = new ArrowLineStroke(s, drawingAttributes);
                        inkCanvas.Strokes.Add(StrokeResult);
                    }
                    );
                }
            }
        }
 public void SetValue(string value)
 {
     try
     {
         if (String.IsNullOrEmpty(value) || !(value.Contains(':'))) return;
         var parts = value.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
         switch (parts[0])
         {
             case "SetDrawingAttributes":
                 //This should come in the format of "SetDrawingAttributes:FF FF FF FF:15:false"
                 if (parts.Count() < 4 || String.IsNullOrEmpty(parts[2]) || String.IsNullOrEmpty(parts[3]) || !(parts[1].Contains(' '))) return;
                 var ARGBvalues = parts[1].Split(new[] { ' ' });
                 if (!(ARGBvalues.Count() == 4)) return;
                 Commands.SetLayer.Execute("sketch");
                 var color = Color.FromArgb(Byte.Parse(ARGBvalues[0]), Byte.Parse(ARGBvalues[1]), Byte.Parse(ARGBvalues[2]), Byte.Parse(ARGBvalues[3]));
                 var da = new DrawingAttributes { Color = color, Height = Double.Parse(parts[2]), Width = Double.Parse(parts[2]), IsHighlighter = Boolean.Parse(parts[3]) };
                 Commands.SetDrawingAttributes.Execute(da);
                 break;
             case "SetInkCanvasMode":
                 //This should come in the format of "SetInkCanvas:Ink"
                 if (parts.Count() < 2 || String.IsNullOrEmpty(parts[1]) || !(new []{"Ink","EraseByStroke","Select","None"}.Contains(parts[1]))) return;
                 Commands.SetInkCanvasMode.Execute(parts[1]);
                 break;                    
             case "SetLayer":
                 //This should come in the format of "SetLayer:Sketch"
                 if (parts.Count() < 2 || String.IsNullOrEmpty(parts[1]) || !(new []{"Select","Sketch","Text","Insert","View"}.Contains(parts[1]))) return;
                 Commands.SetLayer.Execute(parts[1]);
                 break;
         }
     }
     catch (Exception e)
     {
         App.auditor.error("SetValue", "CommandBridgeAutomationPeer", e);
     }
 }
Пример #4
0
        //Переопределение базового метода, который позволяет рисовать круг, имея координаты центра и радиус
        protected override void DrawCore(DrawingContext context, DrawingAttributes overrides)
        {
            StylusPointCollection points = this.GetBezierStylusPoints();

            StylusPoint p1 = points[0];
            context.DrawEllipse(new SolidColorBrush(fillColor), new Pen(new SolidColorBrush(strokeColor), thickness), new Point(p1.X, p1.Y), xRadius, yRaduis);
        }
Пример #5
0
        /// <summary>
        /// Render the StrokeCollection under the specified DrawingContext. This draw method uses the
        /// passing in drawing attribute to override that on the stroke.
        /// </summary>
        /// <param name="drawingContext"></param>
        /// <param name="drawingAttributes"></param>
        public void Draw(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            if (null == drawingContext)
            {
                throw new System.ArgumentNullException("context");
            }

            if (null == drawingAttributes)
            {
                throw new System.ArgumentNullException("drawingAttributes");
            }

            //             context.VerifyAccess();

            //our code never calls this public API so we can assume that opacity
            //has not been set up

            if (drawingAttributes.IsHighlighter)
            {
                drawingContext.PushOpacity(StrokeRenderer.HighlighterOpacity);
                try
                {
                    this.DrawInternal(drawingContext, StrokeRenderer.GetHighlighterAttributes(this, this.DrawingAttributes), false);
                }
                finally
                {
                    drawingContext.Pop();
                }
            }
            else
            {
                this.DrawInternal(drawingContext, drawingAttributes, false);
            }
        }
Пример #6
0
        public override void OnMouseMove(InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                var p = e.GetPosition(inkCanvas);
                if (p != point)
                {
                    point = p;
                    GetBrush(pts, (s) =>
                    {
                        if (StrokeResult != null)
                            inkCanvas.Strokes.Remove(StrokeResult);

                        DrawingAttributes drawingAttributes = new DrawingAttributes
                        {
                            Color = inkCanvas.DefaultDrawingAttributes.Color,
                            Width = inkCanvas.DefaultDrawingAttributes.Width,
                            StylusTip = StylusTip.Ellipse,
                            IgnorePressure = true,
                            FitToCurve = true
                        };

                        StrokeResult = new BrushStroke(s, drawingAttributes);
                        inkCanvas.Strokes.Add(StrokeResult);
                    }
                   );
                }
            }
        }
Пример #7
0
        public override void OnMouseMove(System.Windows.Controls.InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                bottomRight = e.GetPosition(inkCanvas);
                if(topLeft != bottomRight)
                {
                    StylusPointCollection pts = new StylusPointCollection();
                    GetRectangle(pts, (s) =>
                    {
                        if (StrokeResult != null)
                            inkCanvas.Strokes.Remove(StrokeResult);

                        DrawingAttributes drawingAttributes = new DrawingAttributes
                        {
                            Color = inkCanvas.DefaultDrawingAttributes.Color,
                            Width = inkCanvas.DefaultDrawingAttributes.Width,
                            StylusTip = StylusTip.Ellipse,
                            IgnorePressure = true,
                            FitToCurve = true
                        };
                        var BackgroundColor = inkCanvas.DefaultDrawingAttributes.GetPropertyData(DrawAttributesGuid.BackgroundColor);
                        drawingAttributes.AddPropertyData(DrawAttributesGuid.BackgroundColor, BackgroundColor);

                        StrokeResult = new RectangleStroke(s, drawingAttributes);
                        inkCanvas.Strokes.Add(StrokeResult);
                    }
                    );
                }

            }
        }
Пример #8
0
        //-------------------------------------------------------------------------------
        //
        // Public Methods
        //
        //-------------------------------------------------------------------------------

        #region Public Methods

        /// <summary>
        /// AttachVisual method
        /// </summary>
        /// <param name="visual">The stroke visual which needs to be attached</param>
        /// <param name="drawingAttributes">The DrawingAttributes of the stroke</param>
        public void AttachVisuals(Visual visual, DrawingAttributes drawingAttributes)
        {
            VerifyAccess();

            EnsureRootVisual();
            _renderer.AttachIncrementalRendering(visual, drawingAttributes);
        }
Пример #9
0
        public static WindowsInk.Stroke ToWindowsStroke(NineInk.Stroke nineStroke)
        {
            var points = new StylusPointCollection();

            foreach (var point in nineStroke.Points)
                points.Add(new StylusPoint(point.X, point.Y, point.Pressure));

            var drwAttr = new WindowsInk.DrawingAttributes();
            var c = new Color();
            c.R = nineStroke.DrawingAttributes.Color.R;
            c.G = nineStroke.DrawingAttributes.Color.G;
            c.B = nineStroke.DrawingAttributes.Color.B;
            c.A = nineStroke.DrawingAttributes.Color.A;
            drwAttr.Color = c;

            switch (nineStroke.DrawingAttributes.Brush.Name)
            {
                case "Rectangle":
                    drwAttr.StylusTip = WindowsInk.StylusTip.Rectangle;
                    break;
                case "Ellipse":
                default:
                    drwAttr.StylusTip = WindowsInk.StylusTip.Ellipse;
                    break;
            }
            drwAttr.Height = nineStroke.DrawingAttributes.Height;
            drwAttr.Width = nineStroke.DrawingAttributes.Width;
            drwAttr.IsHighlighter = nineStroke.DrawingAttributes.IsHighlighter;

            return new WindowsInk.Stroke(points, drwAttr);
        }
Пример #10
0
        public static WindowsInk.Stroke ToWindowsStroke(NineInk.Stroke nineStroke)
        {
            var points = new StylusPointCollection();

            foreach (var point in nineStroke.Points)
            {
                points.Add(new StylusPoint(point.X, point.Y, point.Pressure));
            }

            var drwAttr = new WindowsInk.DrawingAttributes();
            var c       = new Color();

            c.R           = nineStroke.DrawingAttributes.Color.R;
            c.G           = nineStroke.DrawingAttributes.Color.G;
            c.B           = nineStroke.DrawingAttributes.Color.B;
            c.A           = nineStroke.DrawingAttributes.Color.A;
            drwAttr.Color = c;

            switch (nineStroke.DrawingAttributes.Brush.Name)
            {
            case "Rectangle":
                drwAttr.StylusTip = WindowsInk.StylusTip.Rectangle;
                break;

            case "Ellipse":
            default:
                drwAttr.StylusTip = WindowsInk.StylusTip.Ellipse;
                break;
            }
            drwAttr.Height        = nineStroke.DrawingAttributes.Height;
            drwAttr.Width         = nineStroke.DrawingAttributes.Width;
            drwAttr.IsHighlighter = nineStroke.DrawingAttributes.IsHighlighter;

            return(new WindowsInk.Stroke(points, drwAttr));
        }
Пример #11
0
        protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            if (drawingContext == null)
            {
                throw new ArgumentNullException("drawingContext");
            }
            if (null == drawingAttributes)
            {
                throw new ArgumentNullException("drawingAttributes");
            }
            Pen pen = new Pen
            {
                StartLineCap = PenLineCap.Round,
                EndLineCap = PenLineCap.Round,
                Brush = new SolidColorBrush(drawingAttributes.Color),
                Thickness = drawingAttributes.Width
            };

            BrushConverter bc = new BrushConverter();
            Brush BackGround = (Brush)bc.ConvertFromString(drawingAttributes.GetPropertyData(DrawAttributesGuid.BackgroundColor).ToString());

            drawingContext.DrawRectangle(
                BackGround,
                pen,
                new Rect(new Point(StylusPoints[0].X, StylusPoints[0].Y),
                    new Point(StylusPoints[1].X, StylusPoints[1].Y)));
        }
Пример #12
0
        protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            if (drawingContext == null)
            {
                throw new ArgumentNullException("drawingContext");
            }
            if (null == drawingAttributes)
            {
                throw new ArgumentNullException("drawingAttributes");
            }
            Pen pen = new Pen
            {
                StartLineCap = PenLineCap.Round,
                EndLineCap = PenLineCap.Round,
                Brush = new SolidColorBrush(drawingAttributes.Color),
                Thickness = drawingAttributes.Width
            };

            BrushConverter bc = new BrushConverter();
            Brush BackGround = (Brush)bc.ConvertFromString(drawingAttributes.GetPropertyData(DrawAttributesGuid.BackgroundColor).ToString());
            GeometryConverter gc = new GeometryConverter();
            Geometry geometry = (Geometry)gc.ConvertFromString(string.Format("M {0},{1} {2},{3} {4},{5} Z", StylusPoints[0].X, StylusPoints[1].Y, (Math.Abs(StylusPoints[1].X - StylusPoints[0].X))/2 + StylusPoints[0].X, StylusPoints[0].Y, StylusPoints[1].X, StylusPoints[1].Y));
            GeometryDrawing gd = new GeometryDrawing(BackGround, pen, geometry);
            drawingContext.DrawDrawing(gd);
        }
Пример #13
0
        internal static Cursor GetPenCursor(DrawingAttributes drawingAttributes, bool isHollow, bool isRightToLeft)
        {
            // Create pen Drawing.
            Drawing penDrawing = CreatePenDrawing(drawingAttributes, isHollow, isRightToLeft);

            // Create Cursor from Drawing
            return CreateCursorFromDrawing(penDrawing, new Point(0, 0));
        }
        private void colorPicker_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs <Color?> e)
        {
            var drawingAttrib = new System.Windows.Ink.DrawingAttributes();

            drawingAttrib.Color = colorPicker.SelectedColor ?? default(Color);
            drawingAttrib.Width = size_Slider.Value;
            InkCanvas.DefaultDrawingAttributes = drawingAttrib;
        }
Пример #15
0
        //Переопредение базового метода, которое позволяет построить прямоугольник, имея левую нижнюю и правую верхнюю вершины
        protected override void DrawCore(DrawingContext context, DrawingAttributes overrides)
        {
            StylusPointCollection points = this.StylusPoints;

            StylusPoint p1 = points[0];
            StylusPoint p2 = points[1];

            context.DrawRectangle(new SolidColorBrush(this.fillColor), new Pen(new SolidColorBrush(this.strokeColor), thickness), new Rect((Point)p1, new Vector(p2.X - p1.X, p2.Y - p1.Y)));
        }
Пример #16
0
        //Переопределение базового метода DrawCore, который позволяет отрисовать линию штрихом, соединяющим заданные точки
        protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            StylusPointCollection points = this.StylusPoints;

            StylusPoint p1 = points[0];
            StylusPoint p2 = points[1];

            drawingContext.DrawLine(new Pen(new SolidColorBrush(this.strokeColor), this.thickness), (Point)p1, (Point)p2);
        }
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			Brush colorBrush = (Brush) value;
			SolidColorBrush newBrush = (SolidColorBrush) colorBrush;
			DrawingAttributes attr = new DrawingAttributes()
			                         	{
			                         		Color = newBrush.Color
			                         	};
			return attr;
		}
Пример #18
0
 private void penSize_Click(object sender, RoutedEventArgs e)
 {
     var rad = sender as RadioButton;
     var inkDA = new DrawingAttributes();
     inkDA.Width = rad.FontSize;
     inkDA.Height = rad.FontSize;
     inkDA.Color = InkCanv.DefaultDrawingAttributes.Color;
     inkDA.IsHighlighter = InkCanv.DefaultDrawingAttributes.IsHighlighter;
     InkCanv.DefaultDrawingAttributes = inkDA;
 }
Пример #19
0
 private void penSize_Click(object sender, RoutedEventArgs e)
 {
     RadioButton rad = sender as RadioButton;
     var inkDA = new DrawingAttributes();
     this.InkCanvas.UsesTouchShape = false;
     inkDA.Width = rad.FontSize;
     inkDA.Height = rad.FontSize;
     inkDA.Color = this.InkCanvas.DefaultDrawingAttributes.Color;
     inkDA.IsHighlighter = this.InkCanvas.DefaultDrawingAttributes.IsHighlighter;
     this.InkCanvas.DefaultDrawingAttributes = inkDA;
 }
 public static Cursor generateCursor(DrawingAttributes pen) 
 {
     using (DdMonitor.Lock(lockObject))
     {
         if (pen == previousPen) return previousCursor;
         var color = System.Drawing.Color.FromArgb(pen.Color.A, pen.Color.R, pen.Color.G, pen.Color.B);
         previousPen = pen;
         previousCursor = CursorHelper.CreateCursor((int)pen.Width, (int)pen.Height, color, (int)(pen.Width / 2), (int)(pen.Height / 2));
         return previousCursor;
     }
 }
Пример #21
0
        /// <summary>
        /// Create a new Brush
        /// </summary>
        /// <param name="brushColor">The color of the brush</param>
        /// <param name="brushSize">The width and height of the brush</param>
        /// <returns></returns>
        public DrawingAttributes CreateBrush(Color brushColor, double brushSize)
        {
            DrawingAttributes newDA = new DrawingAttributes();

            newDA.Color = brushColor;
            newDA.IsHighlighter = false;
            newDA.IgnorePressure = true;
            newDA.StylusTip = StylusTip.Ellipse;
            newDA.Height = brushSize;
            newDA.Width = brushSize;

            return newDA;
        }
        private void size_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            var drawingAttrib = new System.Windows.Ink.DrawingAttributes();

            if (colorPicker != null)
            {
                drawingAttrib.Color = colorPicker.SelectedColor ?? Color.FromRgb(0, 0, 0);
            }
            drawingAttrib.Width     = size_Slider.Value;
            drawingAttrib.StylusTip = StylusTip.Ellipse;

            InkCanvas.DefaultDrawingAttributes = drawingAttrib;
        }
Пример #23
0
 public WriteCanvas(WriteForm write, String str)
 {
     InitializeComponent();
     this.write       = write;
     isColorBlind     = write.isColorBlind;
     this.levelStr    = str;
     inkDA            = new System.Windows.Ink.DrawingAttributes();
     inkDA.Color      = Colors.Black;
     inkDA.Height     = 10;
     inkDA.Width      = 10;
     inkDA.FitToCurve = false;
     inkCanvas.DefaultDrawingAttributes = inkDA;
 }
Пример #24
0
 public WriteCanvas(WriteForm write, String str)
 {
     InitializeComponent();
     this.write = write;
     isColorBlind = write.isColorBlind;
     this.levelStr = str;
     inkDA = new System.Windows.Ink.DrawingAttributes();
     inkDA.Color = Colors.Black;
     inkDA.Height = 10;
     inkDA.Width = 10;
     inkDA.FitToCurve = false;
     inkCanvas.DefaultDrawingAttributes = inkDA;
 }
        /// <summary>
        ///     Creates a mutable default value 
        /// </summary>
        internal override object CreateDefaultValue(DependencyObject owner, DependencyProperty property) 
        { 
            // Instantiate our default value instance.
            DrawingAttributes defaultValue = new DrawingAttributes(); 

            // Add event handlers for tracking the changes on the default value instance.
            DrawingAttributesDefaultPromoter promoter = new DrawingAttributesDefaultPromoter((InkCanvas)owner);
 
            defaultValue.AttributeChanged += new PropertyDataChangedEventHandler(promoter.OnDrawingAttributesChanged);
            defaultValue.PropertyDataChanged += new PropertyDataChangedEventHandler(promoter.OnDrawingAttributesChanged); 
 
            return defaultValue;
        } 
Пример #26
0
        public MemoWindow()
        {
            InitializeComponent();

            this._brush = new SolidColorBrush();
            this._pen = new DrawingAttributes();
            this._pen.Width = _pensize;
            this._pen.Height = _pensize;
            this._pen.Color = Colors.Red;
            this._pen.FitToCurve = true;
            this._pen.IsHighlighter = true;
            this._pen.IgnorePressure = true;
            this.Memo.DefaultDrawingAttributes = this._pen;
        }
Пример #27
0
        /// <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);
        }
Пример #28
0
        // Constructor
        public App()
        {
            // Global handler for uncaught exceptions.
            // Note that exceptions thrown by ApplicationBarItem.Click will not get caught here.
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            inkDA = new DrawingAttributes();
            inkDA.Color = Colors.Black;
            inkDA.OutlineColor = Colors.Black;
            inkDA.Width = inkDA.Height = 15d;
        }
Пример #29
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 8 "..\..\MainWindow.xaml"
                ((imagetest.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.editor = ((imagetest.ImageEditor)(target));
                return;

            case 3:

            #line 37 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Back_Click);

            #line default
            #line hidden
                return;

            case 4:

            #line 38 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Next_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.inkCanvas = ((System.Windows.Controls.InkCanvas)(target));
                return;

            case 6:
                this.DrawSetting = ((System.Windows.Ink.DrawingAttributes)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #30
0
        /// <summary>
        /// Creates a default enumerator for a given stroke
        /// If using the strokes drawing attributes, pass stroke.DrawingAttributes for the second
        /// argument.  If using an overridden DA, use that instance.
        /// </summary>
        internal static StrokeNodeIterator GetIterator(StylusPointCollection stylusPoints, DrawingAttributes drawingAttributes)
        {
            if (stylusPoints == null)
            {
                throw new System.ArgumentNullException("stylusPoints");
            }
            if (drawingAttributes == null)
            {
                throw new System.ArgumentNullException("drawingAttributes");
            }

            StrokeNodeOperations operations =
                StrokeNodeOperations.CreateInstance(drawingAttributes.StylusShape);

            bool usePressure = !drawingAttributes.IgnorePressure;

            return new StrokeNodeIterator(stylusPoints, operations, usePressure);
        }
Пример #31
0
            DynamicRendererHostVisual   _strokeHV;  // App thread rendering HostVisual
 
            public StrokeInfo(DrawingAttributes drawingAttributes, int stylusDeviceId, int startTimestamp, DynamicRendererHostVisual hostVisual)
            {
                _stylusId = stylusDeviceId;
                _startTime = startTimestamp; 
                _lastTime = _startTime;
                _drawingAttributes = drawingAttributes.Clone(); // stroke copy for duration of stroke. 
                _strokeNodeIterator = new StrokeNodeIterator(_drawingAttributes); 
                Color color = _drawingAttributes.Color;
                _opacity = _drawingAttributes.IsHighlighter ? 0 : (double)color.A / (double)StrokeRenderer.SolidStrokeAlpha; 
                color.A = StrokeRenderer.SolidStrokeAlpha;

                // Set the brush to be used with this new stroke too (since frozen can be shared by threads)
                SolidColorBrush brush = new SolidColorBrush(color); 
                brush.Freeze();
                _fillBrush = brush; 
                _strokeHV = hostVisual; 
                hostVisual.AddStrokeInfoRef(this); // Add ourselves as reference.
            } 
Пример #32
0
        protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            if (drawingContext == null)
            {
                throw new ArgumentNullException("drawingContext");
            }
            if (null == drawingAttributes)
            {
                throw new ArgumentNullException("drawingAttributes");
            }
            Pen pen = new Pen
            {
                StartLineCap = PenLineCap.Round,
                EndLineCap = PenLineCap.Round,
                Brush = new SolidColorBrush(drawingAttributes.Color),
                Thickness = drawingAttributes.Width
            };

            drawingContext.DrawLine(pen,
                new Point(StylusPoints[0].X, StylusPoints[0].Y),
                new Point(StylusPoints[1].X, StylusPoints[1].Y));

            double HeadWidth = drawingAttributes.Width * 2;
            double HeadHeight = drawingAttributes.Width * 2;
            double theta = Math.Atan2(StylusPoints[0].Y - StylusPoints[1].Y, StylusPoints[0].X - StylusPoints[1].X);
            double sint = Math.Sin(theta);
            double cost = Math.Cos(theta);

            Point pt1 = new Point(
                StylusPoints[1].X + (HeadWidth * cost - HeadHeight * sint),
                StylusPoints[1].Y + (HeadWidth * sint + HeadHeight * cost));

            drawingContext.DrawLine(pen,
            new Point(StylusPoints[1].X, StylusPoints[1].Y),
            new Point(pt1.X, pt1.Y));

            Point pt2 = new Point(
                StylusPoints[1].X + (HeadWidth * cost + HeadHeight * sint),
                StylusPoints[1].Y - (HeadHeight * cost - HeadWidth * sint));

            drawingContext.DrawLine(pen,
            new Point(StylusPoints[1].X, StylusPoints[1].Y),
            new Point(pt2.X, pt2.Y));
        }
Пример #33
0
        public override void OnApplyTemplate()
        {
            if (painter != null)
                Strokes = painter.Strokes;

            if (text != null)
                Name = text.Text;

            if (GetTemplateChild("btnReset") != null)
            {
                reset = GetTemplateChild("btnReset") as SurfaceButton;
                reset.Click += new RoutedEventHandler(btnReset_Click);
            }

            if (GetTemplateChild("txtName") != null)
            {
                text = GetTemplateChild("txtName") as SurfaceTextBox;
                text.TextChanged += new TextChangedEventHandler(text_TextChanged);
                text.Text = Name;
            }

            if (GetTemplateChild("lblName") != null)
            {
                label = GetTemplateChild("lblName") as Label;
                label.Content = Name;
            }

            if (GetTemplateChild("Painter") != null)
            {
                painter = GetTemplateChild("Painter") as SurfaceInkCanvas;
                // Set up the DrawingAttributes for the pen.
                var inkDA = new DrawingAttributes();
                inkDA.Color = Colors.Black;
                inkDA.Height = 1;
                inkDA.Width = 1;
                inkDA.FitToCurve = false;
                painter.UsesTouchShape = false;

                painter.DefaultDrawingAttributes = inkDA;
                if(Strokes != null)
                    painter.Strokes = Strokes;
            }  
            base.OnApplyTemplate();
        }
Пример #34
0
 private void SetDrawingAttributes(DrawingAttributes logicalAttributes)
 {
     if (logicalAttributes == null) return;
     if (me.ToLower() == "projector") return;
     var zoomCompensatedAttributes = logicalAttributes.Clone();
     try
     {
         zoomCompensatedAttributes.Width = logicalAttributes.Width * zoom;
         zoomCompensatedAttributes.Height = logicalAttributes.Height * zoom;
         var visualAttributes = logicalAttributes.Clone();
         visualAttributes.Width = logicalAttributes.Width * 2;
         visualAttributes.Height = logicalAttributes.Height * 2;
         UseCustomCursor = true;
         Cursor = CursorExtensions.generateCursor(visualAttributes);
     }
     catch (Exception e) {
         Trace.TraceInformation("Cursor failed (no crash):", e.Message);
     }
     DefaultDrawingAttributes = zoomCompensatedAttributes;
 }
Пример #35
0
        /// <summary>Create a stroke from a StylusPointCollection</summary>
        /// <remarks>
        /// </remarks>
        /// <param name="stylusPoints">StylusPointCollection that makes up the stroke</param> 
        /// <param name="drawingAttributes">drawingAttributes</param>
        /// <param name="extendedProperties">extendedProperties</param> 
        internal Stroke(StylusPointCollection stylusPoints, DrawingAttributes drawingAttributes, ExtendedPropertyCollection extendedProperties) 
        {
            if (stylusPoints == null) 
            {
                throw new ArgumentNullException("stylusPoints");
            }
            if (stylusPoints.Count == 0) 
            {
                throw new ArgumentException(SR.Get(SRID.InvalidStylusPointCollectionZeroCount), "stylusPoints"); 
            } 
            if (drawingAttributes == null)
            { 
                throw new ArgumentNullException("drawingAttributes");
            }

            _drawingAttributes = drawingAttributes; 
            _stylusPoints = stylusPoints;
            _extendedProperties = extendedProperties; 
 
            Initialize();
        } 
Пример #36
0
        /// <summary>
        /// Whenever the base class fires the generic ExtendedPropertiesChanged
        /// event, we need to fire the DrawingAttributesChanged event also.
        /// </summary>
        /// <param name="sender">Should be 'this' object</param>
        /// <param name="args">The custom attributes that changed</param>
        private void ExtendedPropertiesChanged_EventForwarder(object sender, ExtendedPropertiesChangedEventArgs args)
        {
            System.Diagnostics.Debug.Assert(sender != null);
            System.Diagnostics.Debug.Assert(args != null);

            //see if the EP that changed is a drawingattribute
            if (args.NewProperty == null)
            {
                //a property was removed, see if it is a drawing attribute property
                object defaultValueIfDrawingAttribute
                    = DrawingAttributes.GetDefaultDrawingAttributeValue(args.OldProperty.Id);
                if (defaultValueIfDrawingAttribute != null)
                {
                    ExtendedProperty newProperty =
                        new ExtendedProperty(args.OldProperty.Id,
                                             defaultValueIfDrawingAttribute);
                    //this is a da guid
                    PropertyDataChangedEventArgs dargs =
                        new PropertyDataChangedEventArgs(args.OldProperty.Id,
                                                         newProperty.Value,             //the property
                                                         args.OldProperty.Value);       //previous value

                    this.OnAttributeChanged(dargs);
                }
                else
                {
                    PropertyDataChangedEventArgs dargs =
                        new PropertyDataChangedEventArgs(args.OldProperty.Id,
                                                         null,                    //the property
                                                         args.OldProperty.Value); //previous value

                    this.OnPropertyDataChanged(dargs);
                }
            }
            else if (args.OldProperty == null)
            {
                //a property was added, see if it is a drawing attribute property
                object defaultValueIfDrawingAttribute
                    = DrawingAttributes.GetDefaultDrawingAttributeValue(args.NewProperty.Id);
                if (defaultValueIfDrawingAttribute != null)
                {
                    if (!defaultValueIfDrawingAttribute.Equals(args.NewProperty.Value))
                    {
                        //this is a da guid
                        PropertyDataChangedEventArgs dargs =
                            new PropertyDataChangedEventArgs(args.NewProperty.Id,
                                                             args.NewProperty.Value,          //the property
                                                             defaultValueIfDrawingAttribute); //previous value

                        this.OnAttributeChanged(dargs);
                    }
                }
                else
                {
                    PropertyDataChangedEventArgs dargs =
                        new PropertyDataChangedEventArgs(args.NewProperty.Id,
                                                         args.NewProperty.Value, //the property
                                                         null);                  //previous value
                    this.OnPropertyDataChanged(dargs);
                }
            }
            else
            {
                //something was modified, see if it is a drawing attribute property
                object defaultValueIfDrawingAttribute
                    = DrawingAttributes.GetDefaultDrawingAttributeValue(args.NewProperty.Id);
                if (defaultValueIfDrawingAttribute != null)
                {
                    //
                    // we only raise DA changed when the value actually changes
                    //
                    if (!args.NewProperty.Value.Equals(args.OldProperty.Value))
                    {
                        //this is a da guid
                        PropertyDataChangedEventArgs dargs =
                            new PropertyDataChangedEventArgs(args.NewProperty.Id,
                                                             args.NewProperty.Value,        //the da
                                                             args.OldProperty.Value);       //old value

                        this.OnAttributeChanged(dargs);
                    }
                }
                else
                {
                    if (!args.NewProperty.Value.Equals(args.OldProperty.Value))
                    {
                        PropertyDataChangedEventArgs dargs =
                            new PropertyDataChangedEventArgs(args.NewProperty.Id,
                                                             args.NewProperty.Value,
                                                             args.OldProperty.Value);       //old value

                        this.OnPropertyDataChanged(dargs);
                    }
                }
            }
        }
Пример #37
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.wind = ((lab3_12.MainWindow)(target));
                return;

            case 2:

            #line 17 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click_1);

            #line default
            #line hidden
                return;

            case 3:

            #line 18 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.inkcanvas1 = ((System.Windows.Controls.InkCanvas)(target));
                return;

            case 5:
                this.attrs = ((System.Windows.Ink.DrawingAttributes)(target));
                return;

            case 6:
                this.combobox1 = ((System.Windows.Controls.ComboBox)(target));

            #line 27 "..\..\MainWindow.xaml"
                this.combobox1.DropDownClosed += new System.EventHandler(this.combobox1_DropDownClosed);

            #line default
            #line hidden
                return;

            case 7:
                this.slider1 = ((System.Windows.Controls.Slider)(target));

            #line 73 "..\..\MainWindow.xaml"
                this.slider1.PreviewMouseUp += new System.Windows.Input.MouseButtonEventHandler(this.slider1_PreviewMouseUp);

            #line default
            #line hidden
                return;

            case 8:
                this.statbar3 = ((System.Windows.Controls.Label)(target));
                return;

            case 9:
                this.RadioButton_Boot1 = ((System.Windows.Controls.RadioButton)(target));

            #line 77 "..\..\MainWindow.xaml"
                this.RadioButton_Boot1.Click += new System.Windows.RoutedEventHandler(this.RadioButton_Boot1_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.RadioButton_Boot2 = ((System.Windows.Controls.RadioButton)(target));

            #line 78 "..\..\MainWindow.xaml"
                this.RadioButton_Boot2.Click += new System.Windows.RoutedEventHandler(this.RadioButton_Boot1_Click);

            #line default
            #line hidden
                return;

            case 11:
                this.RadioButton_Boot3 = ((System.Windows.Controls.RadioButton)(target));

            #line 79 "..\..\MainWindow.xaml"
                this.RadioButton_Boot3.Click += new System.Windows.RoutedEventHandler(this.RadioButton_Boot1_Click);

            #line default
            #line hidden
                return;

            case 12:
                this.statbar2 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.statbar1 = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #38
0
 public System.Windows.Media.Geometry GetGeometry(DrawingAttributes drawingAttributes)
 {
     return(default(System.Windows.Media.Geometry));
 }
Пример #39
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.PaintCtrl = ((JPTLaserMarkWPF.ControlView.PaintControl)(target));

            #line 6 "..\..\..\ControlView\PaintControl.xaml"
                this.PaintCtrl.Loaded += new System.Windows.RoutedEventHandler(this.PaintCtrl_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.MenuC = ((System.Windows.Controls.Canvas)(target));
                return;

            case 3:
                this.inkGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.inkC = ((System.Windows.Controls.InkCanvas)(target));
                return;

            case 5:
                this.attribute = ((System.Windows.Ink.DrawingAttributes)(target));
                return;

            case 6:
                this.MainImg = ((System.Windows.Controls.Canvas)(target));
                return;

            case 7:
                this.NewJobBtn = ((System.Windows.Controls.Image)(target));

            #line 26 "..\..\..\ControlView\PaintControl.xaml"
                this.NewJobBtn.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.NewJobBtn_MouseDown);

            #line default
            #line hidden
                return;

            case 8:
                this.UndoBtn = ((System.Windows.Controls.Image)(target));

            #line 27 "..\..\..\ControlView\PaintControl.xaml"
                this.UndoBtn.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.UndoBtn_MouseDown);

            #line default
            #line hidden
                return;

            case 9:
                this.PaintMenuPnl = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 10:
                this.PrintImgBtn = ((System.Windows.Controls.Image)(target));

            #line 29 "..\..\..\ControlView\PaintControl.xaml"
                this.PrintImgBtn.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.PrintImgBtn_MouseDown);

            #line default
            #line hidden
                return;

            case 11:
                this.BackImgPnl = ((System.Windows.Controls.StackPanel)(target));

            #line 30 "..\..\..\ControlView\PaintControl.xaml"
                this.BackImgPnl.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.StackPanel_MouseDown_1);

            #line default
            #line hidden
                return;

            case 12:
                this.BackBtn = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.AlignImgPnl = ((System.Windows.Controls.StackPanel)(target));

            #line 36 "..\..\..\ControlView\PaintControl.xaml"
                this.AlignImgPnl.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.AlignImgPnl_MouseDown);

            #line default
            #line hidden
                return;

            case 14:
                this.AlignLbl = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 15:
                this.PrintImg = ((System.Windows.Controls.Image)(target));

            #line 42 "..\..\..\ControlView\PaintControl.xaml"
                this.PrintImg.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.PrintImg_MouseDown);

            #line default
            #line hidden
                return;

            case 16:
                this.MenuLbl = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #40
0
 public Stroke(System.Windows.Input.StylusPointCollection stylusPoints, DrawingAttributes drawingAttributes)
 {
 }
Пример #41
0
 /// <summary>
 /// Allows addition of objects to the EPC
 /// </summary>
 /// <param name="propertyDataId"></param>
 /// <param name="propertyData"></param>
 public void AddPropertyData(Guid propertyDataId, object propertyData)
 {
     DrawingAttributes.ValidateStylusTipTransform(propertyDataId, propertyData);
     SetExtendedPropertyBackedProperty(propertyDataId, propertyData);
 }
Пример #42
0
        /// <summary>
        /// The core functionality to draw a stroke. The function can be called from the following code paths.
        ///     i) From StrokeVisual.OnRender
        ///         a. Highlighter strokes have been grouped and the correct opacity has been set on the container visual.
        ///         b. For a highlighter stroke with color.A != 255, the DA passed in is a copy with color.A set to 255.
        ///         c. _drawAsHollow can be true, i.e., Selected stroke is drawn as hollow
        ///     ii) From StrokeCollection.Draw.
        ///         a. Highlighter strokes have been grouped and the correct opacity has been pushed.
        ///         b. For a highlighter stroke with color.A != 255, the DA passed in is a copy with color.A set to 255.
        ///         c. _drawAsHollow is always false, i.e., Selected stroke is not drawn as hollow
        ///     iii) From Stroke.Draw
        ///         a. The correct opacity has been pushed for a highlighter stroke
        ///         b. For a highlighter stroke with color.A != 255, the DA passed in is a copy with color.A set to 255.
        ///         c. _drawAsHollow is always false, i.e., Selected stroke is not drawn as hollow
        /// We need to document the following:
        /// 1) our default implementation so developers can see what we've done here -
        ///    including how we handle IsHollow
        /// 2) the fact that opacity has already been set up correctly for the call.
        /// 3) that developers should not call base.DrawCore if they override this
        /// </summary>
        /// <param name="drawingContext">DrawingContext to draw on</param>
        /// <param name="drawingAttributes">DrawingAttributes to draw with</param>
        protected virtual void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            if (null == drawingContext)
            {
                throw new System.ArgumentNullException("drawingContext");
            }

            if (null == drawingAttributes)
            {
                throw new System.ArgumentNullException("drawingAttributes");
            }

            if (_drawAsHollow == true)
            {
                // Draw as hollow. Our profiler result shows that the two-pass-rendering approach is about 5 times
                // faster that using GetOutlinePathGeometry.
                // also, the minimum display size for selected ink is our default width / height

                Matrix            innerTransform, outerTransform;
                DrawingAttributes selectedDA = drawingAttributes.Clone();
                selectedDA.Height = Math.Max(selectedDA.Height, DrawingAttributes.DefaultHeight);
                selectedDA.Width  = Math.Max(selectedDA.Width, DrawingAttributes.DefaultWidth);
                CalcHollowTransforms(selectedDA, out innerTransform, out outerTransform);

                // First pass drawing. Use drawingAttributes.Color to create a solid color brush. The stroke will be drawn as
                // 1 avalon-unit higher and wider (HollowLineSize = 1.0f)
                selectedDA.StylusTipTransform = outerTransform;
                SolidColorBrush brush = new SolidColorBrush(drawingAttributes.Color);
                brush.Freeze();
                drawingContext.DrawGeometry(brush, null, GetGeometry(selectedDA));

                //Second pass drawing with a white color brush. The stroke will be drawn as
                // 1 avalon-unit shorter and narrower (HollowLineSize = 1.0f) if the actual-width/height (considering StylusTipTransform)
                // is larger than HollowLineSize. Otherwise the same size stroke is drawn.
                selectedDA.StylusTipTransform = innerTransform;
                drawingContext.DrawGeometry(Brushes.White, null, GetGeometry(selectedDA));
            }
            else
            {
#if DEBUG_RENDERING_FEEDBACK
                //render debug feedback?
                Guid guid = new Guid("52053C24-CBDD-4547-AAA1-DEFEBF7FD1E1");
                if (this.ContainsPropertyData(guid))
                {
                    double thickness = (double)this.GetPropertyData(guid);

                    //first, draw the outline of the stroke
                    drawingContext.DrawGeometry(null,
                                                new Pen(Brushes.Black, thickness),
                                                GetGeometry());

                    Geometry g2;
                    Rect     b2;
                    //next, overlay the connecting quad points
                    StrokeRenderer.CalcGeometryAndBounds(StrokeNodeIterator.GetIterator(this, drawingAttributes),
                                                         drawingAttributes,
                                                         drawingContext, thickness, true,
                                                         true, //calc bounds
                                                         out g2,
                                                         out b2);
                }
                else
                {
#endif
                SolidColorBrush brush = new SolidColorBrush(drawingAttributes.Color);
                brush.Freeze();
                drawingContext.DrawGeometry(brush, null, GetGeometry(drawingAttributes));
#if DEBUG_RENDERING_FEEDBACK
            }
#endif
            }
        }
Пример #43
0
 public void Draw(System.Windows.Media.DrawingContext drawingContext, DrawingAttributes drawingAttributes)
 {
 }
 public DrawingAttributesReplacedEventArgs(DrawingAttributes newDrawingAttributes, DrawingAttributes previousDrawingAttributes)
 {
 }
Пример #45
0
 protected virtual new void DrawCore(System.Windows.Media.DrawingContext drawingContext, DrawingAttributes drawingAttributes)
 {
 }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 16 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.Open_CanExecute);

            #line default
            #line hidden

            #line 16 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.Open_Executed);

            #line default
            #line hidden
                return;

            case 2:

            #line 17 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.New_CanExecute);

            #line default
            #line hidden

            #line 17 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.New_Executed);

            #line default
            #line hidden
                return;

            case 3:

            #line 18 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.Save_CanExecute);

            #line default
            #line hidden

            #line 18 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.Save_Executed);

            #line default
            #line hidden
                return;

            case 4:
                this.MainTopMenu = ((System.Windows.Controls.Menu)(target));
                return;

            case 5:
                this.brushSizeTextBox = ((System.Windows.Controls.TextBox)(target));

            #line 68 "..\..\MainWindow.xaml"
                this.brushSizeTextBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.brushSizeTextBox_TextChanged);

            #line default
            #line hidden
                return;

            case 6:
                this.colorBtn = ((System.Windows.Controls.Button)(target));

            #line 74 "..\..\MainWindow.xaml"
                this.colorBtn.Click += new System.Windows.RoutedEventHandler(this.colorBtn_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.PictureSizeXTextBox = ((System.Windows.Controls.TextBox)(target));

            #line 84 "..\..\MainWindow.xaml"
                this.PictureSizeXTextBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.XSizeTextBox_TextChanged);

            #line default
            #line hidden
                return;

            case 8:
                this.PictureSizeYTextBox = ((System.Windows.Controls.TextBox)(target));

            #line 95 "..\..\MainWindow.xaml"
                this.PictureSizeYTextBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.YSizeTextBox_TextChanged);

            #line default
            #line hidden
                return;

            case 9:
                this.eraserBtnTwo = ((System.Windows.Controls.Button)(target));

            #line 111 "..\..\MainWindow.xaml"
                this.eraserBtnTwo.Click += new System.Windows.RoutedEventHandler(this.eraserBtnTwo_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.eraserSizeTxtBox = ((System.Windows.Controls.TextBox)(target));

            #line 126 "..\..\MainWindow.xaml"
                this.eraserSizeTxtBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.eraserSizeTxtBox_TextChanged);

            #line default
            #line hidden
                return;

            case 11:
                this.ColorPickerUC = ((PaintAppTwo.UserControls.ColorPickerUserControl)(target));
                return;

            case 12:
                this.mainCanvas = ((System.Windows.Controls.InkCanvas)(target));
                return;

            case 13:
                this.MainCanvasAttribute = ((System.Windows.Ink.DrawingAttributes)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #47
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MyCalendar = ((System.Windows.Controls.Calendar)(target));

            #line 22 "..\..\MainWindow.xaml"
                this.MyCalendar.SelectedDatesChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.MyCalendar_SelectedDatesChanged);

            #line default
            #line hidden
                return;

            case 2:
                this.tbDateSelected = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:

            #line 36 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.TabItem)(target)).KeyUp += new System.Windows.Input.KeyEventHandler(this.DrawPanel_KeyUp);

            #line default
            #line hidden
                return;

            case 4:
                this.drawingToolbar = ((System.Windows.Controls.ToolBar)(target));
                return;

            case 5:
                this.DrawButton = ((System.Windows.Controls.RadioButton)(target));

            #line 49 "..\..\MainWindow.xaml"
                this.DrawButton.Click += new System.Windows.RoutedEventHandler(this.DrawButton_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.EraseButton = ((System.Windows.Controls.RadioButton)(target));

            #line 50 "..\..\MainWindow.xaml"
                this.EraseButton.Click += new System.Windows.RoutedEventHandler(this.DrawButton_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.SelectButton = ((System.Windows.Controls.RadioButton)(target));

            #line 51 "..\..\MainWindow.xaml"
                this.SelectButton.Click += new System.Windows.RoutedEventHandler(this.DrawButton_Click);

            #line default
            #line hidden
                return;

            case 8:

            #line 52 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveButton_Click);

            #line default
            #line hidden
                return;

            case 9:

            #line 53 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OpenButton_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.DrawingCanvas = ((System.Windows.Controls.InkCanvas)(target));
                return;

            case 11:
                this.strokeAttr = ((System.Windows.Ink.DrawingAttributes)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #48
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 16 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.ComboBoxItem)(target)).Selected += new System.Windows.RoutedEventHandler(this.Pick_Color);

            #line default
            #line hidden
                return;

            case 2:

            #line 17 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.ComboBoxItem)(target)).Selected += new System.Windows.RoutedEventHandler(this.Pick_Color);

            #line default
            #line hidden
                return;

            case 3:

            #line 18 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.ComboBoxItem)(target)).Selected += new System.Windows.RoutedEventHandler(this.Pick_Color);

            #line default
            #line hidden
                return;

            case 4:

            #line 19 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.ComboBoxItem)(target)).Selected += new System.Windows.RoutedEventHandler(this.Pick_Color);

            #line default
            #line hidden
                return;

            case 5:
                this.Ink = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 6:
                this.Select = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 7:
                this.EraseByPoint = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 8:
                this.EraseByStroke = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 9:
                this.canvas_item = ((System.Windows.Controls.InkCanvas)(target));
                return;

            case 10:
                this.inkAttributes = ((System.Windows.Ink.DrawingAttributes)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 13 "..\..\..\Views\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.Open_CanExecute);

            #line default
            #line hidden

            #line 13 "..\..\..\Views\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.Open_Executed);

            #line default
            #line hidden
                return;

            case 2:

            #line 14 "..\..\..\Views\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.New_CanExecute);

            #line default
            #line hidden

            #line 14 "..\..\..\Views\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.New_Executed);

            #line default
            #line hidden
                return;

            case 3:

            #line 15 "..\..\..\Views\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.Save_CanExecute);

            #line default
            #line hidden

            #line 15 "..\..\..\Views\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.Save_Executed);

            #line default
            #line hidden
                return;

            case 4:
                this.openMenuBtn = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 5:
                this.newMenuBtn = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 6:
                this.saveMenuBtn = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 7:
                this.brushSizeTextBox = ((System.Windows.Controls.TextBox)(target));

            #line 68 "..\..\..\Views\MainWindow.xaml"
                this.brushSizeTextBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.brushSizeTextBox_TextChanged);

            #line default
            #line hidden
                return;

            case 8:
                this.colorBtn = ((System.Windows.Controls.Button)(target));

            #line 75 "..\..\..\Views\MainWindow.xaml"
                this.colorBtn.Click += new System.Windows.RoutedEventHandler(this.colorBtn_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.colorLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 10:
                this.mainCanvas = ((System.Windows.Controls.InkCanvas)(target));
                return;

            case 11:
                this.MainAttribute = ((System.Windows.Ink.DrawingAttributes)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #50
0
 /// <summary>Create a stroke from a StylusPointCollection</summary>
 /// <remarks>
 /// </remarks>
 /// <param name="stylusPoints">StylusPointCollection that makes up the stroke</param>
 /// <param name="drawingAttributes">drawingAttributes</param>
 public Stroke(StylusPointCollection stylusPoints, DrawingAttributes drawingAttributes)
     : this(stylusPoints, drawingAttributes, null)
 {
 }
Пример #51
0
 /// <summary>
 /// DrawingAttributesReplacedEventArgs
 /// </summary>
 /// <remarks>
 /// This must be public so InkCanvas can instance it
 /// </remarks>
 public DrawingAttributesReplacedEventArgs(DrawingAttributes newDrawingAttributes, DrawingAttributes previousDrawingAttributes)
 {
     if (newDrawingAttributes == null)
     {
         throw new ArgumentNullException("newDrawingAttributes");
     }
     if (previousDrawingAttributes == null)
     {
         throw new ArgumentNullException("previousDrawingAttributes");
     }
     _newDrawingAttributes      = newDrawingAttributes;
     _previousDrawingAttributes = previousDrawingAttributes;
 }
Пример #52
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 19 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.ComboBoxItem)(target)).Selected += new System.Windows.RoutedEventHandler(this.Pick_Color);

            #line default
            #line hidden
                return;

            case 2:

            #line 20 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.ComboBoxItem)(target)).Selected += new System.Windows.RoutedEventHandler(this.Pick_Color);

            #line default
            #line hidden
                return;

            case 3:

            #line 21 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.ComboBoxItem)(target)).Selected += new System.Windows.RoutedEventHandler(this.Pick_Color);

            #line default
            #line hidden
                return;

            case 4:

            #line 22 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.ComboBoxItem)(target)).Selected += new System.Windows.RoutedEventHandler(this.Pick_Color);

            #line default
            #line hidden
                return;

            case 5:

            #line 27 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Slider)(target)).ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.Slider_ValueChanged);

            #line default
            #line hidden
                return;

            case 6:
                this.ink_mode = ((System.Windows.Controls.RadioButton)(target));

            #line 30 "..\..\MainWindow.xaml"
                this.ink_mode.Checked += new System.Windows.RoutedEventHandler(this.Mode_Checked);

            #line default
            #line hidden
                return;

            case 7:
                this.select_mode = ((System.Windows.Controls.RadioButton)(target));

            #line 31 "..\..\MainWindow.xaml"
                this.select_mode.Checked += new System.Windows.RoutedEventHandler(this.Mode_Checked);

            #line default
            #line hidden
                return;

            case 8:
                this.eraseByPoint_mode = ((System.Windows.Controls.RadioButton)(target));

            #line 32 "..\..\MainWindow.xaml"
                this.eraseByPoint_mode.Checked += new System.Windows.RoutedEventHandler(this.Mode_Checked);

            #line default
            #line hidden
                return;

            case 9:
                this.eraseByStroke_mode = ((System.Windows.Controls.RadioButton)(target));

            #line 33 "..\..\MainWindow.xaml"
                this.eraseByStroke_mode.Checked += new System.Windows.RoutedEventHandler(this.Mode_Checked);

            #line default
            #line hidden
                return;

            case 10:
                this.canvas_item = ((System.Windows.Controls.InkCanvas)(target));
                return;

            case 11:
                this.inkAttributes = ((System.Windows.Ink.DrawingAttributes)(target));
                return;
            }
            this._contentLoaded = true;
        }