DrawApi() As Draw
not used


Returns the draw object of the current picture offering several drawing operations.
The object "Draw" can only be used with the event "Draw".

For the use of events in an object, DynPicture of this picture 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 in ProjectActive.

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

DynPicture, Draw