Draw(hdc As OLE_HANDLE,Right As Long,Left As Long,Bottom As Long,Top As Long)


Handle of the current picture.
Right As Long
Right border of the area to draw.
Left As Long
Left border of the area to draw
Bottom As Long
Lower border of the area to draw.
Top As Long
Upper border of the area to draw.
not used


This event is executed on drawing the current picture. As long as the picture is open, this event is executed cyclically.

The parameters Left, Top, Bottom and Right define the area to be updated. For the whole picture this would constitute the definition of the template. Updating the whole picture is done with UpdateAll.

Hint: For the use of events, the "DynPicture" object must be defined with WithEvents.


The following example uses the object Draw. Opening the picture DRAW_API executes the event Draw. The object Picture must be defined with WithEvents. The picture is found inProjectActive.

Private WithEvents m_obDialogPic As DynPicture
Private m_obPicDraw As Draw

'*** Initialize the project
Private Sub Project_Active()
	'*** get picture DRAW_API for draw-event
	Set m_obDialogPic = thisProject.DynPictures.Item("DRAW_API")
	If (m_obDialogPic Is Nothing) Then
		MsgBox "Error: invalid-picture..."
		Exit Sub
	End If

	Set m_obPicDraw = m_obDialogPic.DrawApi
End Sub

'*** Drawing with drawapi of the picture
Private Sub m_obDialogPic_Draw(ByVal hdc As stdole.OLE_HANDLE, _
							 ByVal Left As Long, ByVal Top As Long, _
							 ByVal Bottom As Long, ByVal Right As Long)

	If (Not m_obPicDraw Is Nothing) Then
		m_obPicDraw.SetBkColor hdc, vbMagenta
		m_obPicDraw.FillSolidRect hdc, 200, 200, 200, 200, vbBlue
	End If
End Sub

See Also