Compartilhar via


InkPicture.Painted Event

InkPicture.Painted Event

Occurs when the InkPicture object has completed redrawing itself.

Definition

Visual Basic .NET Public Event Painted As InkOverlayPaintedEventHandler
C# public event InkOverlayPaintedEventHandler Painted;
Managed C++ public: __event InkOverlayPaintedEventHandler Painted;

Remarks

The event handler receives an argument of type PaintEventArgs Leave Site that contains data about this event.

When you create an InkOverlayPaintedEventHandler delegate, you identify the method that will handle 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.

Examples

[C#]

This C# example shows how you can count the number of times that an InkPicture named theInkPicture is painted.

using Microsoft.Ink;
//...
  private int paintCount = 0;
//...
  theInkPicture.Painted += new InkOverlayPaintedEventHandler(theInkPicture_Painted);
//...
  private void theInkPicture_Painted(object sender, System.Windows.Forms.PaintEventArgs e)
  {
      paintCount++;
      System.Diagnostics.Debug.WriteLine("Painted " + paintCount.ToString() + " times.");
  }
//...

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example shows how you can count the number of times that an InkPicture named theInkPicture is painted.

Imports Microsoft.Ink
'...
    Private paintCount As Integer = 0
    Private WithEvents theInkPicture As InkPicture
'...

    Private Sub theInkPicture_Painted(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) _
    Handles theInkPicture.Painted
        paintCount = paintCount + 1
        System.Diagnostics.Debug.WriteLine("Painted " + paintCount.ToString() + " times.")
    End Sub
'...

See Also