Exemplo n.º 1
0
                public ScribblePanel(PenPropertiesPage owner, Point location, Size size, int tabIndex)
                {
                    this.SuspendLayout();
                    this.Owner = owner;
                    owner.DrawingAttributesChanged += new EventHandler(this.OnDrawingAttributesChanged);

                    this.Location    = location;
                    this.Size        = size;
                    this.TabIndex    = tabIndex;
                    this.Name        = "ScribbleArea";
                    this.BackColor   = Color.White;
                    this.BorderStyle = BorderStyle.FixedSingle;

                    // Add the controls
                    this.Controls.Add(new ScribbleClearButton(this, new Point(40, 168), new Size(80, 23), 0));

                    this.RealTimeStylus          = new RealTimeStylus(this);
                    this.DynamicRenderer         = new DynamicRenderer(this);
                    this.DynamicRenderer.Enabled = true;
                    //this.DynamicRenderer.EnableDataCache = true;
                    this.RealTimeStylus.SyncPluginCollection.Add(this.DynamicRenderer);
                    this.RealTimeStylus.Enabled = true;

                    this.ResumeLayout();
                }
Exemplo n.º 2
0
 // EventHandlerPlugIn constructor
 public EventHandlerPlugIn(Graphics graph, DynamicRenderer render)
 {
     graphics        = graph;
     cntContacts     = 0;
     touchColor      = new TouchColor();
     dynamicRenderer = render;
 }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
 public void SetInkTool(DynamicRenderer dynamicRenderer)
 {
     if (dynamicRenderer != null)
     {
         DynamicRenderer = dynamicRenderer;
     }
 }
        private TouchColor touchColor; // color generator

        #endregion Fields

        #region Constructors

        // EventHandlerPlugIn constructor
        public EventHandlerPlugIn(Graphics graph, DynamicRenderer render)
        {
            graphics = graph;
            cntContacts = 0;
            touchColor = new TouchColor();
            dynamicRenderer = render;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Custom InkCanvas element to collect
        /// and render high contrast ink
        /// </summary>
        public HighContrastInkCanvas()
            : base()
        {
            // set Color, Width and Height for the inner stroke
            this.DynamicRenderer.DrawingAttributes.Color  = Colors.Chocolate;
            this.DynamicRenderer.DrawingAttributes.Width  = 3d;
            this.DynamicRenderer.DrawingAttributes.Height = 3d;

            // create a second DynamicRenderer
            outerDynamicRenderer = new DynamicRenderer();
            outerDynamicRenderer.DrawingAttributes         = this.DefaultDrawingAttributes.Clone();
            outerDynamicRenderer.DrawingAttributes.Color   = Colors.DarkGreen;
            outerDynamicRenderer.DrawingAttributes.Width  *= 1.4d;
            outerDynamicRenderer.DrawingAttributes.Height *= 1.4d;

            // plug the new DynamicRenderer in, so that it can receive
            // real-time stylus notifications
            this.StylusPlugIns.Add(outerDynamicRenderer);

            // re-order the RootVisuals of our DynamicRendererd, so that
            // the inner stroke gets rendered on top of the outer stroke
            this.InkPresenter.DetachVisuals(this.DynamicRenderer.RootVisual);
            this.InkPresenter.AttachVisuals(outerDynamicRenderer.RootVisual, outerDynamicRenderer.DrawingAttributes);
            this.InkPresenter.AttachVisuals(this.DynamicRenderer.RootVisual, this.DynamicRenderer.DrawingAttributes);
        }
        public static DynamicRenderer Clone(this DynamicRenderer renderer)
        {
            var dr = new DynamicRenderer();

            dr.DrawingAttributes = renderer.DrawingAttributes.Clone();
            return(dr);
        }
        public virtual ActionResult BatchEdit(UpdateListPageModel items)
        {
            if (items is null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            //This will be used to hold the returned entities while we build our return object
            List <object> Entities = this.GetEntitiesByGuids(items.Guids.Select(s => Guid.Parse(s)).ToList());

            //We're gonna use this to determine the eventual return type of the list
            Type commonType = Entities.GetCommonType();

            DynamicRenderer renderer = new DynamicRenderer(new DynamicRendererSettings(commonType, this.FileProvider)
            {
                ExactOnly = true
            });

            BatchEditModelPageModel BEmodel = new BatchEditModelPageModel
            {
                Guids    = items.Guids,
                Template = Activator.CreateInstance(commonType)
            };

            MetaObject model = new MetaObject(BEmodel, Constructor);

            model.Hydrate();

            return(this.View(model));
        }
Exemplo n.º 9
0
        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);
        }
        /// <summary>
        /// Event Handler from Form Load Event
        /// Set up the real time stylus for collection
        /// </summary>
        /// <param name="sender">The control that raised the event.</param>
        /// <param name="e">The event arguments.</param>
        private void InkCollection_Load(object sender, System.EventArgs e)
        {
            // Create the renderers.  The dynamic renderer is used to render the ink
            // stroke that is currently being collected, whereas the static renderer
            // is used to render strokes that have already been collected.
            myDynamicRenderer = new DynamicRenderer(this);
            myRenderer        = new Renderer();

            //
            // If you do not modify the default drawing attributes, the default
            // drawing attributes will use the following properties and values:
            //
            //      AntiAliased     = true
            //      Color           = black
            //      FitToCurve      = false
            //      Height          = 1
            //      IgnorePressure  = false
            //      PenTip          = ball
            //      RasterOperation = copy pen
            //      Transparency    = 0
            //      Width           = 53 (2 pixels on a 96 dpi screen)
            //
            // For an example of how to modify other drawing attributes, uncomment
            // the following lines of code:
            // myDynamicRenderer.DrawingAttributes.PenTip = PenTip.Rectangle;
            // myDynamicRenderer.DrawingAttributes.Height = (.5F)*MediumInkWidth;
            // myDynamicRenderer.DrawingAttributes.Transparency = 128;
            //

            // Create the real time stylus used to receive stylus notifications
            myRealTimeStylus = new RealTimeStylus(this, true);

            // Add the dynamic renderer to the synchronous plugin notification chain.
            // Synchronous notifications occur on the pen thread.
            myRealTimeStylus.SyncPluginCollection.Add(myDynamicRenderer);

            // Add the form to the asynchronous plugin notification chain.  This plugin
            // will be used to collect stylus data into an ink object.  Asynchronous
            // notifications occur on the UI thread.
            myRealTimeStylus.AsyncPluginCollection.Add(this);

            // Enable the real time stylus and the dynamic renderer
            myRealTimeStylus.Enabled  = true;
            myDynamicRenderer.Enabled = true;

            // Create the ink object used to store ink collected from the real time stylus
            myPackets = new Hashtable();
            myInk     = new Ink();
        }
Exemplo n.º 11
0
        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);
        }
        /// <summary>
        /// Gets the view result containing editor view information for the current metaObject
        /// </summary>
        /// <param name="metaObject">The MetaObject to get view information for</param>
        /// <param name="requestContext">The current RequestContext</param>
        /// <param name="displayType">The type to be used when finding the view, if not the MetaObject type</param>
        /// <returns>A result containing editor view information</returns>
        protected DynamicViewResult?GetView(IMetaObject metaObject, DisplayContexts requestContext, IMetaType?displayType = null)
        {
            if (metaObject is null)
            {
                throw new ArgumentNullException(nameof(metaObject));
            }

            string BasePath = $"/Areas/Admin/Views/{requestContext}/";

            if (metaObject.IsRoot())
            {
                return(null);
            }

            IMetaProperty property = metaObject.Property;

            displayType ??= GetDisplayType(metaObject);

            string Key = $"{displayType.AssemblyQualifiedName}+{property?.Name}+{requestContext}";

            if (!Views.TryGetValue(Key, out string?path))
            {
                DynamicRenderer renderer = new DynamicRenderer(new DynamicRendererSettings(displayType, property, this.FileProvider)
                {
                    BasePath = BasePath
                });

                if (renderer.IsDynamic)
                {
                    Views.TryAdd(Key, null);
                }
                else
                {
                    path = renderer.MatchedPath;
                    Views.TryAdd(Key, path);
                }
            }

            if (string.IsNullOrWhiteSpace(path))
            {
                return(null);
            }
            else
            {
                return(new DynamicViewResult(path));
            }
        }
        // OnLoad window event handler
        // in:
        //      sender      object that has sent the event
        //      e           event arguments
        private void OnLoadHandler(Object sender, EventArgs e)
        {
            // Create RealTimeStylus object and enable it for multi-touch
            realTimeStylus = new RealTimeStylus(this);
            realTimeStylus.MultiTouchEnabled = true;

            // Create DynamicRenderer and event handler, and add them to the RTS object as synchronous plugins
            dynamicRenderer = new DynamicRenderer(this);
            eventHandler = new EventHandlerPlugIn(this.CreateGraphics(), dynamicRenderer);
            realTimeStylus.SyncPluginCollection.Add(eventHandler);
            realTimeStylus.SyncPluginCollection.Add(dynamicRenderer);

            // Enable RTS and DynamicRenderer object, and enable auto-redraw of the DynamicRenderer
            realTimeStylus.Enabled = true;
            dynamicRenderer.Enabled = true;
            dynamicRenderer.EnableDataCache = true;
        }
Exemplo n.º 14
0
        // OnLoad window event handler
        // in:
        //      sender      object that has sent the event
        //      e           event arguments
        private void OnLoadHandler(Object sender, EventArgs e)
        {
            // Create RealTimeStylus object and enable it for multi-touch
            realTimeStylus = new RealTimeStylus(this);
            realTimeStylus.MultiTouchEnabled = true;

            // Create DynamicRenderer and event handler, and add them to the RTS object as synchronous plugins
            dynamicRenderer = new DynamicRenderer(this);
            eventHandler    = new EventHandlerPlugIn(this.CreateGraphics(), dynamicRenderer);
            realTimeStylus.SyncPluginCollection.Add(eventHandler);
            realTimeStylus.SyncPluginCollection.Add(dynamicRenderer);

            // Enable RTS and DynamicRenderer object, and enable auto-redraw of the DynamicRenderer
            realTimeStylus.Enabled          = true;
            dynamicRenderer.Enabled         = true;
            dynamicRenderer.EnableDataCache = true;
        }
Exemplo n.º 15
0
        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>
        }
Exemplo n.º 16
0
        public override void Perform()
        {
            if (TargetInkCanvas.StylusPlugInCollection.Count > 0)
            {
                InkPresenter inkPresenter = TargetInkCanvas.CustomInkPresenter;

                int             index           = CountIndex % TargetInkCanvas.StylusPlugInCollection.Count;
                DynamicRenderer dynamicRenderer = TargetInkCanvas.StylusPlugInCollection[index] as DynamicRenderer;
                if (dynamicRenderer == null)
                {
                    return;
                }

                if (dynamicRenderer != TargetInkCanvas.CustomDynamicRenderer)
                {
                    inkPresenter.DetachVisuals(dynamicRenderer.RootVisual);
                    TargetInkCanvas.StylusPlugInCollection.Remove(dynamicRenderer);
                }
                else
                {
                    // A sign of gotten a stylus plug-in object
                    bool foundOne = false;
                    foreach (DynamicRenderer plugin in TargetInkCanvas.StylusPlugInCollection)
                    {
                        if (plugin != dynamicRenderer)
                        {
                            TargetInkCanvas.CustomDynamicRenderer = plugin;
                            foundOne = true;
                            break;
                        }
                    }
                    if (!foundOne)
                    {
                        TargetInkCanvas.CustomDynamicRenderer = null;
                    }
                }
            }
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
        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();
        }
Exemplo n.º 19
0
                public ScribblePanel(PenPropertiesPage owner, Point location, Size size, int tabIndex)
                {
                    this.SuspendLayout();
                    this.Owner = owner;
                    owner.DrawingAttributesChanged += new EventHandler(this.OnDrawingAttributesChanged);

                    this.Location = location;
                    this.Size = size;
                    this.TabIndex = tabIndex;
                    this.Name = "ScribbleArea";
                    this.BackColor = Color.White;
                    this.BorderStyle = BorderStyle.FixedSingle;

                    // Add the controls
                    this.Controls.Add(new ScribbleClearButton(this, new Point(40, 168), new Size(80, 23), 0));

                    this.RealTimeStylus = new RealTimeStylus(this);
                    this.DynamicRenderer = new DynamicRenderer(this);
                    this.DynamicRenderer.Enabled = true;
                    //this.DynamicRenderer.EnableDataCache = true;
                    this.RealTimeStylus.SyncPluginCollection.Add(this.DynamicRenderer);
                    this.RealTimeStylus.Enabled = true;

                    this.ResumeLayout();
                }
        /// <summary>
        /// Event Handler from Form Load Event
        /// Setup the real time stylus for collection.
        /// </summary>
        /// <param name="sender">The control that raised the event.</param>
        /// <param name="e">The event arguments.</param>
        private void RealTimeStylusPlugin_Load(object sender, System.EventArgs e)
        {
            // Create the real time stylus used to receive stylus notifications
            myRealTimeStylus = new RealTimeStylus(gbTestArea, true);

            // Store the Graphics object associated with the drawing area.
            customDynamicRendererGraphics = gbTestArea.CreateGraphics();

            // Create the plugins.  Note that since these are
            // synchronous plugins, notification will occur on the
            // pen thread.
            //
            // -PacketFilterPlugin: demonstrates packet modification by
            //  constraining all x,y packet data within a rectangular area.
            // -CustomDynamicRendererPlugin:  demonstrates custom dynamic
            //  rendering by drawing a small circle around each x,y.
            // -GestureRecognizer:  plugin provided by the Tablet PC Platform
            //  API, which recognizes application gestures.
            // -DynamicRenderer:  plugin provided by Tablet PC Platform API,
            // which renders packet data as it is collected.

            // Create the PacketFilterPlugin
            // Note that this custom plugin takes a rectangle in
            // ink space coordinates (.01mm = 1 ink space unit), which
            // specifies the filter region.  This sample uses a rectangle
            // that is centered over the drawing area.
            float right  = ((float)gbTestArea.Width*2540.0F)/(float)customDynamicRendererGraphics.DpiX;
            float bottom = ((float)gbTestArea.Height*2540.0F)/(float)customDynamicRendererGraphics.DpiY;
            Rectangle filterRect = new Rectangle((int)Math.Round(.15F*right),
                                                 (int)Math.Round(.15F*bottom),
                                                 (int)Math.Round(.7F*right),
                                                 (int)Math.Round(.7F*bottom));
            IStylusSyncPlugin filterPlugin = new PacketFilterPlugin(filterRect);
            chklbPlugins.Items.Add(new PluginListItem(filterPlugin,"PacketFilter"));

            // Create the CustomDynamicRendererPlugin
            IStylusSyncPlugin rendererPlugin = new CustomDynamicRendererPlugin(customDynamicRendererGraphics);
            chklbPlugins.Items.Add(new PluginListItem(rendererPlugin,"CustomDynamicRenderer"));

            // Attempt to create the GestureRecognizer plugin.
            // An exception will occur if no recognizers are available.
            // In this case, the sample proceeds, but does not add the
            // gesture recognizer into the list of available plugins.
            GestureRecognizer gr = null;
            try
            {
                gr = new GestureRecognizer();
                ApplicationGesture [] gestures = { ApplicationGesture.AllGestures };
                gr.EnableGestures(gestures);
                chklbPlugins.Items.Add(new PluginListItem(gr,"GestureRecognizer"));
            }
            catch
            {
            }

            // Create the dynamic renderer used to render the stroke that is
            //  currently being collected
            DynamicRenderer dr = new DynamicRenderer(gbTestArea);
            chklbPlugins.Items.Add(new PluginListItem(dr,"DynamicRenderer"));

            // Enable all plugins
            for(int i = 0; i < chklbPlugins.Items.Count; i++)
            {
                chklbPlugins.SetItemChecked(i,true);
            }

            // Add this form to the collection of asynchronous plugins.
            // The CustomStylusDataAdded notification will be used to
            // update the form's UI when an application gesture occurs.
            // Since this is an asynchronous plugin, notification will
            // occur on the UI thread.
            myRealTimeStylus.AsyncPluginCollection.Add(this);

            // Enable the RealTimeStylus, GestureRecognizer, and DynamicRenderer
            myRealTimeStylus.Enabled = true;
            if (gr != null)
            {
                gr.Enabled = true;
            }
            dr.Enabled = true;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Event Handler from Form Load Event
        /// Set up the real time stylus for collection
        /// </summary>
        /// <param name="sender">The control that raised the event.</param>
        /// <param name="e">The event arguments.</param>
        private void InkCollection_Load(object sender, System.EventArgs e)
        {
            // Create the renderers.  The dynamic renderer is used to render the ink
            // stroke that is currently being collected, whereas the static renderer
            // is used to render strokes that have already been collected.
            myDynamicRenderer = new DynamicRenderer(this);
            myRenderer = new Renderer();

            //
            // If you do not modify the default drawing attributes, the default
            // drawing attributes will use the following properties and values:
            //
            //      AntiAliased     = true
            //      Color           = black
            //      FitToCurve      = false
            //      Height          = 1
            //      IgnorePressure  = false
            //      PenTip          = ball
            //      RasterOperation = copy pen
            //      Transparency    = 0
            //      Width           = 53 (2 pixels on a 96 dpi screen)
            //
            // For an example of how to modify other drawing attributes, uncomment
            // the following lines of code:
            // myDynamicRenderer.DrawingAttributes.PenTip = PenTip.Rectangle;
            // myDynamicRenderer.DrawingAttributes.Height = (.5F)*MediumInkWidth;
            // myDynamicRenderer.DrawingAttributes.Transparency = 128;
            //

            // Create the real time stylus used to receive stylus notifications
            myRealTimeStylus = new RealTimeStylus(this, true);

            // Add the dynamic renderer to the synchronous plugin notification chain.
            // Synchronous notifications occur on the pen thread.
            myRealTimeStylus.SyncPluginCollection.Add(myDynamicRenderer);

            // Add the form to the asynchronous plugin notification chain.  This plugin
            // will be used to collect stylus data into an ink object.  Asynchronous
            // notifications occur on the UI thread.
            myRealTimeStylus.AsyncPluginCollection.Add(this);

            // Enable the real time stylus and the dynamic renderer
            myRealTimeStylus.Enabled = true;
            myDynamicRenderer.Enabled = true;

            // Create the ink object used to store ink collected from the real time stylus
            myPackets = new Hashtable();
            myInk = new Ink();
        }
Exemplo n.º 22
0
        /// <summary>
        /// Event Handler from Form Load Event
        /// Setup the real time stylus for collection.
        /// </summary>
        /// <param name="sender">The control that raised the event.</param>
        /// <param name="e">The event arguments.</param>
        private void RealTimeStylusPlugin_Load(object sender, System.EventArgs e)
        {
            // Create the real time stylus used to receive stylus notifications
            myRealTimeStylus = new RealTimeStylus(gbTestArea, true);

            // Store the Graphics object associated with the drawing area.
            customDynamicRendererGraphics = gbTestArea.CreateGraphics();

            // Create the plugins.  Note that since these are
            // synchronous plugins, notification will occur on the
            // pen thread.
            //
            // -PacketFilterPlugin: demonstrates packet modification by
            //  constraining all x,y packet data within a rectangular area.
            // -CustomDynamicRendererPlugin:  demonstrates custom dynamic
            //  rendering by drawing a small circle around each x,y.
            // -GestureRecognizer:  plugin provided by the Tablet PC Platform
            //  API, which recognizes application gestures.
            // -DynamicRenderer:  plugin provided by Tablet PC Platform API,
            // which renders packet data as it is collected.

            // Create the PacketFilterPlugin
            // Note that this custom plugin takes a rectangle in
            // ink space coordinates (.01mm = 1 ink space unit), which
            // specifies the filter region.  This sample uses a rectangle
            // that is centered over the drawing area.
            float     right      = ((float)gbTestArea.Width * 2540.0F) / (float)customDynamicRendererGraphics.DpiX;
            float     bottom     = ((float)gbTestArea.Height * 2540.0F) / (float)customDynamicRendererGraphics.DpiY;
            Rectangle filterRect = new Rectangle((int)Math.Round(.15F * right),
                                                 (int)Math.Round(.15F * bottom),
                                                 (int)Math.Round(.7F * right),
                                                 (int)Math.Round(.7F * bottom));
            IStylusSyncPlugin filterPlugin = new PacketFilterPlugin(filterRect);

            chklbPlugins.Items.Add(new PluginListItem(filterPlugin, "PacketFilter"));

            // Create the CustomDynamicRendererPlugin
            IStylusSyncPlugin rendererPlugin = new CustomDynamicRendererPlugin(customDynamicRendererGraphics);

            chklbPlugins.Items.Add(new PluginListItem(rendererPlugin, "CustomDynamicRenderer"));

            // Attempt to create the GestureRecognizer plugin.
            // An exception will occur if no recognizers are available.
            // In this case, the sample proceeds, but does not add the
            // gesture recognizer into the list of available plugins.
            GestureRecognizer gr = null;

            try
            {
                gr = new GestureRecognizer();
                ApplicationGesture [] gestures = { ApplicationGesture.AllGestures };
                gr.EnableGestures(gestures);
                chklbPlugins.Items.Add(new PluginListItem(gr, "GestureRecognizer"));
            }
            catch
            {
            }

            // Create the dynamic renderer used to render the stroke that is
            //  currently being collected
            DynamicRenderer dr = new DynamicRenderer(gbTestArea);

            chklbPlugins.Items.Add(new PluginListItem(dr, "DynamicRenderer"));

            // Enable all plugins
            for (int i = 0; i < chklbPlugins.Items.Count; i++)
            {
                chklbPlugins.SetItemChecked(i, true);
            }

            // Add this form to the collection of asynchronous plugins.
            // The CustomStylusDataAdded notification will be used to
            // update the form's UI when an application gesture occurs.
            // Since this is an asynchronous plugin, notification will
            // occur on the UI thread.
            myRealTimeStylus.AsyncPluginCollection.Add(this);

            // Enable the RealTimeStylus, GestureRecognizer, and DynamicRenderer
            myRealTimeStylus.Enabled = true;
            if (gr != null)
            {
                gr.Enabled = true;
            }
            dr.Enabled = true;
        }