Painting Event
Painting Event |
Occurs before the InkOverlay object or InkPicture has completed redrawing itself.
Declaration
[C++]
void Painting(
[in] long hDC,
[in] IInkRectangle* Rect,
[in, out] VARIANT_BOOL* Allow
);
[Microsoft® Visual Basic® 6.0]
Public Event Painting( _
hDC As Long, _
Rect As InkRectangle, _
Allow As Boolean _
)
Parameters
hDC
[in] The device context on which painting will occur.
Rect
[in] The IInkRectangle that is to be repainted.
Allow
[in, out] Whether the repaint will occur.
Remarks
This event method is defined in the _IInkOverlayEvents and _IInkPictureEvents dispatch-only interfaces (dispinterfaces) with an ID of DISPID_IOEPainting.
Example
[Visual Basic 6.0]
This Visual Basic 6.0 example demonstrates adding a Painting and a Painted event handler to an InkOverlay object. Paint events are initiated with a command button, CommandRepaint, or by the usual Window events. The Painting event handler is invoked before the Paint event begins, and causes the Color and Width drawing attributes to be randomized before the ink is painted. The Painted event handler writes information about the number of times the paint event has occurred in a text box, Text1.
Option Explicit
Dim WithEvents theInkOverlay As InkOverlay
Dim countPaint As Integer
Private Sub CommandRepaint_Click()
Refresh
End Sub
Private Sub Form_Load()
Randomize
Set theInkOverlay = New InkOverlay
theInkOverlay.hWnd = Me.hWnd
theInkOverlay.Enabled = True
countPaint = 0
End Sub
Private Sub theInkOverlay_Painted( _
ByVal hDC As Long, _
ByVal Rect As MSINKAUTLib.IInkRectangle)
Text1.Text = "InkOverlay painted " & countPaint & " times."
countPaint = countPaint + 1
End Sub
Private Sub theInkOverlay_Painting( _
ByVal hDC As Long, _
ByVal Rect As MSINKAUTLib.IInkRectangle, _
Allow As Boolean)
Dim theDrawingAttributes As New InkDrawingAttributes
theDrawingAttributes.Color = RGB(Int(255 * Rnd), Int(255 * Rnd), Int(255 * Rnd))
theDrawingAttributes.Width = Int(240 * Rnd) + 30
theInkOverlay.Ink.Strokes.ModifyDrawingAttributes theDrawingAttributes
End Sub
Applies To
- InkOverlay Object (Automation Library Reference)
- InkPicture Control (Automation Library Reference)