DIBMP:DrawDIB() Method
<< Click to Display Table of Contents >> DIBMP:DrawDIB() Method |
![]() ![]() ![]() |
Purpose
To draw a previously loaded bitmap on a Windows device context.
Syntax
<oDIBMP>:DrawDIB(hDC, [nY], [nX], [nHeight], [nWidth], [nStartRow], [nStartCol], [lStretch], [lRetainAspect])
Arguments
hDC |
Windows device context to draw the bitmap on. |
nY |
Optional. The top row (in logical pixels) of the bitmap. The default is 0. |
nX |
Optional. The left column (in logical pixels) of the bitmap. The default is 0. |
nHeight |
Optional. The height of the bitmap. The default is the height stored in the bitmap (the actual height of the bitmap). |
nWidth |
Optional. The width of the bitmap. The default is the width stored in the bitmap (the actual width of the bitmap). |
nStartRow |
Optional. The row in the bitmap where drawing will start. The default is the first row. |
nStartCol |
Optional. The column in the bitmap where drawing will start. The default is the first column. |
lStretch |
Optional. If TRUE, the bitmap is stretched (or shrunk) to fit into nHeight and nWidth. If FALSE, the bitmap is clipped to nHeight and nWidth. |
lRetainAspect |
Optional. If TRUE, when the bitmap is stretched (or shrunk) to fit into the nHeight and nWidth, the original aspect ratio of the bitmap will be preserved. The default is FALSE. |
Example
// Draw a DIB on a window.
// NOTE: This approach will not work
// on a shell window
oDIBMP:LoadDIBFromFile("C:\WINDOWS\CASTLE.BMP")
if oDIBMP:IsValid
hDC:=GetDC(self:Handle(0))
SaveDC(hDC)
SetMapMode(hDC, MM_TEXT)
SetWindowOrg(hDC, 0, 0)
SetViewPortOrg(hDC, 0, 0)
oDIBMP:DrawDIB(hDC)
RestoreDC(hDC, -1)
ReleaseDC(self:Handle(0), hDC)
endif
oDIBMP:Destroy()