I have a drawing canvas in my app which maintains an private buffer
for refreshes. I gave it a print method to handle printing itself
when needed. It checks to see if it's smaller than the Graphics page
from the OpenPrinterDialog, and if needed scales itself. Normal
printing works fine, and the scaling calculations in the "else" part
work fine too. But the call to DrawPicture with the DestWidth and
DestHeight params doesn't seem to have any effect on the Buffer as
drawn in the page.
Thought?
Steve
// returns number of pages printed
Dim scale as double
Dim top, left as integer
// check size of current buffer
if ((Buffer.width < page.Width) and (Buffer.height < page.height -
offset)) then
// simply print Buffer to page
// center in vertical and horizontal space
top = ((page.height - offset)\2) - (buffer.height\2)
left = (page.width\2) - (buffer.width\2)
page.DrawPicture Buffer, left, top
else
// need to scale
// find limiting ratio of page to buffer
scale = Min((page.width/buffer.width), (page.height/buffer.height))
// center in vertical and horizontal space
top = ((page.height - offset)\2) - ((scale*buffer.height)\2)
left = (page.width\2) - ((scale*buffer.width)\2)
dim w,h as integer
w = scale*buffer.width
h = scale*buffer.height
// draw scaled
page.DrawPicture Buffer, left, top, w, h
end if
return 0
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>