InkOverlay.Painting Event
Assembly: Microsoft.Ink (in microsoft.ink.dll)
'Declaration Public Event Painting As InkOverlayPaintingEventHandler 'Usage Dim instance As InkOverlay Dim handler As InkOverlayPaintingEventHandler AddHandler instance.Painting, handler
/** @event */ public void add_Painting (InkOverlayPaintingEventHandler value) /** @event */ public void remove_Painting (InkOverlayPaintingEventHandler value)
In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.
The event handler receives an argument of type InkOverlayPaintingEventArgs containing data about this event.
When you create a InkOverlayPaintingEventHandler delegate, you identify the method that handles the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For performance reasons, the default event interest is off but is turned on automatically if you add an event handler.
This C# example invokes a Painting event handler that assigns random values to the DrawingAttributes object's Color and Width properties before the ink is painted.
using Microsoft.Ink; //... theInkOverlay.Painting += new InkOverlayPaintedEventHandler(inkOverlay_Painting); //... private void inkOverlay_Painting(object sender, InkOverlayPaintingEventArgs e) { DrawingAttributes theDrawingAttributes = new DrawingAttributes(); Random randomGenerator = new Random(); theDrawingAttributes.Color = Color.FromArgb(randomGenerator.Next(255), randomGenerator.Next(255), randomGenerator.Next(255)); theDrawingAttributes.Width = randomGenerator.Next(240) + 30; theInkOverlay.Ink.Strokes.ModifyDrawingAttributes(theDrawingAttributes); } //...
This Microsoft Visual Basic .NET example invokes an Painting event handler that assigns random values to the DrawingAttributes object's Color and Width properties before the ink is painted.
Imports Microsoft.Ink '... Private WithEvents theInkOverlay As InkOverlay '... Private Sub theInkOverlay_Painting(ByVal sender As Object, ByVal e As Microsoft.Ink.InkOverlayPaintingEventArgs)_ Handles theInkOverlay.Painting Dim theDrawingAttributes As New DrawingAttributes() Dim randomGenerator As New Random() theDrawingAttributes.Color = Color.FromArgb(randomGenerator.Next(255), _ randomGenerator.Next(255), randomGenerator.Next(255)) theDrawingAttributes.Width = randomGenerator.Next(240) + 30 theInkOverlay.Ink.Strokes.ModifyDrawingAttributes(theDrawingAttributes) End Sub '...
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.