| xHarbour Reference Documentation > Class Reference (textmode) |
![]() |
![]() |
![]() |
Creates a new Win32Bmp object.
Win32Bmp():new()
The function returns a new Win32Bmp object and method :new() initializes the object.
Objects of class Win32Bmp are used in conjunction with objects of the Win32Prn class for printing bitmap images using the Windows Graphical Device Interface (GDI). For this reason, an application using Win32Bmp objects must be created as GUI application. Text mode applications, or console applications, cannot use the Win32Bmp class.
A Win32Bmp object is capable of loading a bitmap file into memory with its :loadFile() method. After the bitmap image is loaded, it can be printed with the aid of a Win32Prn() object using method :draw().
| See also: | Win32Prn() |
| Category: | Object functions , Printer functions , xHarbour extensions |
| Source: | rtl\win32prn.prg |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example outlines the steps required for printing
// a bitmap image
PROCEDURE Main
LOCAL cFileName, oWin32Bmp, oWin32Prn
oWin32Prn := Win32Prn():new() // default printer object
IF .NOT. oWin32Prn:create() // create device context
Alert( "Unable to create device context for printer" )
QUIT
ENDIF
cFileName := "TestImage.bmp"
oWin32Bmp := Win32Bmp():new() // load bitmap file into memory
IF .NOT. oWin32Bmp:loadFile( cFileName )
Alert( "Unable to load bitmap file: " + cFileName )
QUIT
ENDIF
// print bitmap image
oWin32Bmp:draw( oWin32Prn, { 200, 400, 2000, 1500 } )
// release GDI system resources of printer
oWin32Prn:destroy()
RETURN
http://www.xHarbour.com