ListBox printer has been created by Alex Restrepo. So according to Alex you will need to modify the Printer setup object in the print method for margins and give appropriate margins.
Here is the Print Method:
Code:
dim printer as graphics
dim setup as printerSetup
dim totalWidth as integer
dim row, column as integer
dim columnScale as single
dim sx, sy, w, h, maxH, xs(), i as integer
self.source=source
setup=new printerSetup
if setup.PageSetupDialog then
printer=openprinterDialog(setup)
if printer<>nil then
if fitWidth then
//find total width
for row=0 to source.columncount-1
totalWidth=totalWidth+source.column(row).widthActual
next
columnScale=setup.width/totalWidth
else
columnScale=1
end if
sx=0
sy = self.printHeaders(0,printer,columnscale,xs)+3
for row=0 to source.listcount-1
for column=0 to source.columncount-1
w=source.column(column).widthActual*columnScale
'self.printCell(row,column,printer,sx,sy,w,h)
self.printCell(row,column,printer,xs(column),sy,w,h)
if h>maxH then maxH=h
next
sx=0
sy=sy+maxH+2
maxH=0
if sy+printer.textascent>setup.height then
for i=0 to ubound(xs)
printer.foreColor=lineColor
printer.drawline xs(i),headerHeight,xs(i),printer.height
printer.foreColor=textcolor
next
printer.nextPage
sy=self.printHeaders(0,printer,columnscale,xs)+3
end if
next
for i=0 to ubound(xs)
printer.foreColor=linecolor
printer.drawline xs(i),headerHeight,xs(i),printer.height
printer.foreColor=textcolor
next
end if
end if
Bookmarks