//</Snippet5> //<Snippet7> void DrawingAttributesChanged(object sender, PropertyDataChangedEventArgs e) { // Reattach the visual of the DynamicRenderer to the InkPresenter // whenever the DrawingAttributes change. presenter.DetachVisuals(renderer.RootVisual); presenter.AttachVisuals(renderer.RootVisual, renderer.DrawingAttributes); }
public InkSelector() { mode = InkMode.Ink; // Use an InkPresenter to display the strokes on the custom control. presenter = new InkPresenter(); this.Content = presenter; //<Snippet4> // In the constructor. // Selection drawing attributes use dark gray ink. selectDA = new DrawingAttributes(); selectDA.Color = Colors.DarkGray; // ink drawing attributes use default attributes inkDA = new DrawingAttributes(); inkDA.Width = 5; inkDA.Height = 5; inkDA.AttributeChanged += new PropertyDataChangedEventHandler(DrawingAttributesChanged); selectDA.AttributeChanged += new PropertyDataChangedEventHandler(DrawingAttributesChanged); //</Snippet4> // Add a DynmaicRenderer to the control so ink appears // to "flow" from the tablet pen. renderer = new DynamicRenderer(); renderer.DrawingAttributes = inkDA; this.StylusPlugIns.Add(renderer); presenter.AttachVisuals(renderer.RootVisual, renderer.DrawingAttributes); }
public override void Perform() { InkPresenter inkPresenter = TargetInkCanvas.CustomInkPresenter; inkPresenter.AttachVisuals(DynamicRenderer.RootVisual, DynamicRenderer.DrawingAttributes); TargetInkCanvas.StylusPlugInCollection.Add(DynamicRenderer); }
public StylusControl() { // Add an InkPresenter for drawing inkPresenter1 = new InkPresenter(); // When StylusContol is a Label this.Content = inkPresenter1; // When StylusContol is a Border //this.Child = inkPresenter1; // Add a custom filter plugin that restricts the // input area first, before rendering occurs filterPlugin1 = new FilterPlugin(); filterPlugin1.StrokeRendered += new StrokeRenderedEventHandler(filterPlugin1_StrokeRendered); this.StylusPlugIns.Add(filterPlugin1); cdr = new CustomDynamicRenderer2(); cdr.DrawingAttributes.Color = Colors.Green; currentAttributes = cdr.DrawingAttributes; inkPresenter1.AttachVisuals(cdr.RootVisual, cdr.DrawingAttributes); //this.StylusPlugIns.Add(cdr); AttatchDynamicRenderer(); recoPlugin = new RecognizerPlugin(); //this.StylusPlugIns.Add(recoPlugin); //DrawRect(cdr.Rect); }
public InqCanvas(bool keepstroqs) : base() { KeepStroqs = keepstroqs; _inkPresenter.AttachVisuals(_dynamicRenderer.RootVisual, _dynamicRenderer.DrawingAttributes); StylusPlugIns.Add(_dynamicRenderer); AddLogicalChild(_inkPresenter); AddVisualChild(_inkPresenter); InvalidateMeasure(); _stroqs.Changed += new EventHandler <StroqCollection.ChangedEventArgs>(stroqs_Changed); DynamicRenderer.ForcedMove += new MyRend.ForcedMoveHandler(DynamicRenderer_ForcedMove); }
public InkControl() { // Add an InkPresenter for drawing. ip = new InkPresenter(); this.Content = ip; // Add a dynamic renderer that // draws ink as it "flows" from the stylus. dr = new DynamicRenderer(); ip.AttachVisuals(dr.RootVisual, dr.DrawingAttributes); this.StylusPlugIns.Add(dr); }
public StefansStylusControl() { Stylus.Enable(); ip = new InkPresenter(); this.Content = ip; //for label //this.Child = ip; //for border inPlugins = new ArrayList(); outPlugins = new ArrayList(); Matrix translateMatrix = new Matrix(); translateMatrix.Translate(20d, 50d); translatePlugin.Plugin = new TransformPlugin(translateMatrix); translatePlugin.Name = "Translate Plugin"; outPlugins.Add(translatePlugin); filterPlugin.Plugin = new FilterPlugin(); filterPlugin.Name = "Filter Plugin"; outPlugins.Add(filterPlugin); CustomDynamicRenderer cr = new CustomDynamicRenderer(); customrenderer.Plugin = cr; customrenderer.Name = "Custom Renderer"; outPlugins.Add(customrenderer); ip.AttachVisuals(cr.RootVisual, cr.DrawingAttributes); //this.StylusPlugIns.Add(cr); DynamicRenderer dr = new DynamicRenderer(); dynamicRenderer.Plugin = dr; dynamicRenderer.Name = "Standard Renderer"; inPlugins.Add(dynamicRenderer); ip.AttachVisuals(dr.RootVisual, dr.DrawingAttributes); this.StylusPlugIns.Add(dr); }
public RealTimeInkControl() : base() { recognizer = new GestureRecognizer(); ClipToBoundsProperty.OverrideMetadata(typeof(RealTimeInkControl), new FrameworkPropertyMetadata(true)); // Use an InkPresenter to display the strokes on the custom control. presenter = new InkPresenter(); this.Child = presenter; renderer = new DynamicRenderer(); this.StylusPlugIns.Add(renderer); presenter.AttachVisuals(renderer.RootVisual, renderer.DrawingAttributes); }
public Ink3d() { // Use an InkPresenter to display the strokes on the control. presenter = new InkPresenter(); this.Child = presenter; inkDA = new DrawingAttributes(); inkDA.Width = 5; inkDA.Height = 5; //inkDA.AddPropertyData(shadow, false); //inkDA.PropertyDataChanged += new PropertyDataChangedEventHandler(inkDA_PropertyDataChanged); renderer.DrawingAttributes = inkDA; this.StylusPlugIns.Add(renderer); presenter.AttachVisuals(renderer.RootVisual, renderer.DrawingAttributes); }
private void AttatchDynamicRenderer() { //<Snippet3> // Create a DrawingAttributes to use for the // DynamicRenderer. DrawingAttributes inkDA = new DrawingAttributes(); inkDA.Width = 5; inkDA.Height = 5; inkDA.Color = Colors.Purple; // Add a dynamic renderer plugin that // draws ink as it "flows" from the stylus DynamicRenderer dynamicRenderer1 = new DynamicRenderer(); dynamicRenderer1.DrawingAttributes = inkDA; this.StylusPlugIns.Add(dynamicRenderer1); inkPresenter1.AttachVisuals(dynamicRenderer1.RootVisual, dynamicRenderer1.DrawingAttributes); //</Snippet3> }
public MyBorder() { gotFirstStroke = false; // Set the default state if no button is clicked state = sMode.add; myInkPresenter = new InkPresenter(); Child = myInkPresenter; inkAttributes = new DrawingAttributes(); inkAttributes.Color = Colors.Green; inkAttributes.Width = 5; inkAttributes.Height = 5; renderer = new DynamicRenderer(); renderer.DrawingAttributes = inkAttributes; this.StylusPlugIns.Add(renderer); myInkPresenter.AttachVisuals(renderer.RootVisual, renderer.DrawingAttributes); StrokeConstructorSample(); }