示例#1
0
        //Prevent DrawAttributes object be replaced in InkCanvas
        private void inkCanvas_DefaultDrawingAttributesReplaced(object sender, DrawingAttributesReplacedEventArgs e)
        {
            var inkCanvas = ((InkCanvas)sender);

            inkCanvas.DefaultDrawingAttributesReplaced -= inkCanvas_DefaultDrawingAttributesReplaced;
            inkCanvas.DefaultDrawingAttributes          = _sharedDrawingAttributes;
            inkCanvas.DefaultDrawingAttributesReplaced += inkCanvas_DefaultDrawingAttributesReplaced;
        }
示例#2
0
 private void OnDrawingAttributesReplaced(Object sender, DrawingAttributesReplacedEventArgs args)
 {
     // If the drawing attributes change involves Width, Height, StylusTipTransform, IgnorePressure, or FitToCurve,
     // we need to invalidate
     if (false == DrawingAttributes.GeometricallyEqual(args.NewDrawingAttributes, args.PreviousDrawingAttributes))
     {
         Invalidate();
     }
 }
示例#3
0
        protected virtual void OnDefaultDrawingAttributesReplaced(object sender, DrawingAttributesReplacedEventArgs e)
        {
            DrawingAttributesReplacedEventHandler handler = DefaultDrawingAttributesReplaced;

            if (handler != null)
            {
                handler(this, e);
            }
        }
示例#4
0
        // <Snippet16>
        protected override void OnDrawingAttributesReplaced(DrawingAttributesReplacedEventArgs e)
        {
            //// Notify base class of event
            //base.OnDrawingAttributesReplaced(e);

            //if (e.NewDrawingAttributes.Color == Colors.Red)
            //{
            //    MessageBox.Show("The stroke is now red!");
            //}
        }
示例#5
0
 //<Snippet17>
 void inkCanvas1_DefaultDrawingAttributesReplaced(object sender, DrawingAttributesReplacedEventArgs e)
 {
     if (e.NewDrawingAttributes.IsHighlighter)
     {
         this.Title = "Now using a highlighter.";
     }
     else
     {
         this.Title = "Now using a pen.";
     }
 }
示例#6
0
 void myNewStroke_DrawingAttributesReplaced(object sender, DrawingAttributesReplacedEventArgs e)
 {
 }
示例#7
0
 private void DefaultDrawingAttributesReplaced(object sender, DrawingAttributesReplacedEventArgs e)
 {
     Trace.WriteLine("InkCanvas default drawing attributes replaced.");
 }
示例#8
0
 protected override void OnDrawingAttributesReplaced(DrawingAttributesReplacedEventArgs e)
 {
     base.OnDrawingAttributesReplaced(e);
     InitPen();
 }
示例#9
0
 protected override void OnDefaultDrawingAttributesReplaced(DrawingAttributesReplacedEventArgs e)
 {
     base.OnDefaultDrawingAttributesReplaced(e);
 }
示例#10
0
 protected override void OnDefaultDrawingAttributesReplaced(DrawingAttributesReplacedEventArgs e)
 {
     CreateBrush();
     e.NewDrawingAttributes.AttributeChanged      += DefaultDrawingAttributes_AttributeChanged;
     e.PreviousDrawingAttributes.AttributeChanged -= DefaultDrawingAttributes_AttributeChanged;
 }