bOk = MImgDraw( hImage, hDC, nLeft, nTop, nRight, nBottom, nFlags )

Draws an image in the specified device context.

Parameters
hImage
Number: Handle of the image

hDC
Number: Handle of the device context

nLeft, nTop, nRight, nBottom
Number: Rectangle to draw the image into. The image is stretched to fit into the rectangle.

nFlags
Number: Draw flags

Return
Boolean: TRUE if successful or FALSE if an error occurs

Example
In this example an image is drawn centered into a window:

! Get the DC
Set hDC = GetDC( hWnd )
If hDC
  ! Get the image size
  Call MImgGetSize( hImage, nWidth, nHeight )
  ! Get the client rectangle of the window
  Call GetClientRect( hWnd, nLeft, nTop, nRight, nBottom )
  ! Calculate the draw rectangle
  Set nLeft = SalNumberTruncate( SalNumberMax( 0, ( ( nRight - nLeft ) - nWidth ) / 2 ), 10, 0 )
  Set nTop = SalNumberTruncate( SalNumberMax( 0, ( ( nBottom - nTop ) - nHeight ) / 2 ), 10, 0 )
  Set nRight = nLeft + nWidth
  Set nBottom = nTop + nHeight
  ! Draw it
  Call MImgDraw( hImage, hDC, nLeft, nTop, nRight, nBottom, 0 )
  ! Release the DC
  ReleaseDC( hWnd, hDC )

See also
MImgDrawAligned
MImgDrawPattern
MImgSetDrawClipRect
MImgSetDrawState

Created with the Personal Edition of HelpNDoc: Free EPub producer