internal StylusAsyncPlugin(IStylusReaderHooks subject, Control attached)
 {
     Graphics g = subject.CreateGraphics();
     attachedControl = attached;
     this.ratio = new PointF(g.DpiX / 2540.0f, g.DpiY / 2540.0f);
     this.subject = subject;
 }
        internal StylusAsyncPlugin(IStylusReaderHooks subject, Control attached)
        {
            Graphics g = subject.CreateGraphics();

            attachedControl = attached;
            this.ratio      = new PointF(g.DpiX / 2540.0f, g.DpiY / 2540.0f);
            this.subject    = subject;
        }
Exemple #3
0
        public static void HookStylus(IStylusReaderHooks subject, Control control)
        {
            if (hookedControls.Contains(control))
            {
                throw new ApplicationException("control is already hooked");
            }

            RealTimeStylus stylus = new RealTimeStylus(control, true);
            PaintDotNet.StylusAsyncPlugin stylusReader = new PaintDotNet.StylusAsyncPlugin(subject, control);
            
            stylus.AsyncPluginCollection.Add(stylusReader);
            stylus.SetDesiredPacketDescription(new Guid[] { PacketProperty.X, 
                                                            PacketProperty.Y, 
                                                            PacketProperty.NormalPressure, 
                                                            PacketProperty.PacketStatus});
            stylus.Enabled = true;

            control.Disposed += new EventHandler(control_Disposed);

            WeakReference weakRef = new WeakReference(control);
            hookedControls.Add(weakRef, stylus);
        }
        public static void HookStylus(IStylusReaderHooks subject, Control control)
        {
            if (hookedControls.Contains(control))
            {
                throw new ApplicationException("control is already hooked");
            }

            RealTimeStylus stylus = new RealTimeStylus(control, true);

            PaintDotNet.StylusAsyncPlugin stylusReader = new PaintDotNet.StylusAsyncPlugin(subject, control);

            stylus.AsyncPluginCollection.Add(stylusReader);
            stylus.SetDesiredPacketDescription(new Guid[] { PacketProperty.X,
                                                            PacketProperty.Y,
                                                            PacketProperty.NormalPressure,
                                                            PacketProperty.PacketStatus });
            stylus.Enabled = true;

            control.Disposed += new EventHandler(control_Disposed);

            WeakReference weakRef = new WeakReference(control);

            hookedControls.Add(weakRef, stylus);
        }