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); }