Поделиться через


Design Considerations for the StylusInput APIs

Design Considerations for the StylusInput APIs

Overview of considerations for designing an application that uses the StylusInput application programming interfaces (APIs).

  • You can update the WindowInputRectangle property of the RealTimeStylus object and the ClipRectangle property of the DynamicRenderer object while the pen is down. This can be useful when you want to have a dynamic drawing area while the application is collecting ink.

  • The RealTimeStylus object's plug-in collections are ordered. The relative position of your plug-ins within these collections can be very important. For example, a plug-in that modifies packet information should probably be added to the synchronous plug-in collection before a dynamic-renderer plug-in.

  • The ability to add custom stylus data to the tablet pen's data stream should be used sparingly. Use this feature only if another plug-in needs to receive this information as part of the data stream. Also, avoid adding custom stylus data in response to other custom stylus data coming into the plug-in, as this can create an infinite loop.

  • Plug-in collections can be modified while the RealTimeStylus object is enabled; however, this can make the behavior of your application harder to predict. When a plug-in is added while the RealTimeStylus object is enabled, the RealTimeStylus object calls the plug-in's IStylusSyncPlugin.RealTimeStylusEnabled or IStylusAsyncPlugin.RealTimeStylusEnabled method. When a plug-in is removed while the RealTimeStylus object is enabled, the RealTimeStylus object calls the plug-in's IStylusSyncPlugin.RealTimeStylusDisabled or IStylusAsyncPlugin.RealTimeStylusDisabled method. This is to allow the plug-in to maintain its proper state without having to poll the RealTimeStylus object.

    Note: For overall stability, reset a plug-in's internal state when its RealTimeStylusDisabled method is called.

    Note: The RealTimeStylus object throws an exception if any of its plug-ins updates either of the RealTimeStylus object's plug-in collections. The RealTimeStylus object also throws an exception if any of its plug-ins calls the RealTimeStylus object's Dispose method.