Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Fit to Window or Print preview (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Re: RB thread "paused" whenever a GUI action such as window dragging or resize occurs - sign on to FR here...
Next thread: RB thread "paused" whenever a GUI action such as window dragging or resize occurs


FW: Special Valentine's Offer for Valentina - Beat the Price Increase!   -   Lynn Fredricks
  Fit to Window or Print preview   -   Karl Holmes
   Re: Fit to Window or Print preview   -   Andy Dent
   Re: Fit to Window or Print preview   -   Karl Holmes

Fit to Window or Print preview
Date: 02.08.07 07:13 (Thu, 2 Aug 2007 16:13:49 +1000)
From: Karl Holmes
Anyone have any ideas how to create a Print Preview of a window?
I am using the following method to print some worksheets from an
educational program.
I have created a window equal in size to an A4 page and have draw the
worksheet into this window so that a teacher could see what they are
getting before printing.

Only problem is that at some resolutions eg 800x600 the window does
not fit on the screen and hence the contents cannot all be seen.

I would like to have either some way to reduce the window so that it
fits (like what happens in Excel or Appleworks or any number of
graphics programs - usually under 'View' menu and expressed as % eg
50% or 200% etc) OR alternatively have a print preview button which
shows what is going to be printed OR any other suitable approach.

Any ideas gratefully received.

Karl

dim p as picture
dim g as graphics

P = newPicture(self.width,self.height,32)
self.drawInto p.graphics, 0,0
g = openPrinterDialog()
if g <> nil then
g.drawPicture p,10,3
end if

Re: Fit to Window or Print preview
Date: 02.08.07 08:45 (Thu, 02 Aug 2007 15:45:49 +0800)
From: Andy Dent
Quoting Karl Holmes <<email address removed>>:
> I am using the following method to print some worksheets from an
> educational program.
> ...
> Only problem is that at some resolutions eg 800x600 the window does
> not fit on the screen and hence the contents cannot all be seen.
...

The answer is to make DrawPicture scale the picture for you, if you
don't want to scroll.
>
> dim p as picture
> dim g as graphics
const xOff = 10
const yOff = 3
>
> P = newPicture(self.width,self.height,32)
> self.drawInto p.graphics, 0,0
> g = openPrinterDialog()
> if g <> nil then
> g.drawPicture p,10,3

' copy entire picture to scaled rectangle at offset
g.DrawPicture p, _
xOff, yOff, g.Width-xOff, g.Height-yOff, _
0, 0, p.Width, p.Height
> end if

http://www.oofile.com.au/downloads.html#DownloadREALbasic

contains the PrintMasking sample which shows zooming with a scrolling window.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Fit to Window or Print preview
Date: 03.08.07 01:46 (Fri, 3 Aug 2007 10:46:12 +1000)
From: Karl Holmes
Thanks Andy
Of course - so obvious. Sometimes the brain gets stuck on what is
really simple, trying to make things much more complex than they
really are. Sigh!

Karl

>Quoting Karl Holmes <<email address removed>>:
>> I am using the following method to print some worksheets from an
>> educational program.
>> ...
>> Only problem is that at some resolutions eg 800x600 the window does
>> not fit on the screen and hence the contents cannot all be seen.
>...
>
>The answer is to make DrawPicture scale the picture for you, if you
>don't want to scroll.
>>
>> dim p as picture
>> dim g as graphics
>const xOff = 10
>const yOff = 3
>>
>> P = newPicture(self.width,self.height,32)
>> self.drawInto p.graphics, 0,0
>> g = openPrinterDialog()
>> if g <> nil then
>> g.drawPicture p,10,3
>
> ' copy entire picture to scaled rectangle at offset
> g.DrawPicture p, _
> xOff, yOff, g.Width-xOff, g.Height-yOff, _
> 0, 0, p.Width, p.Height
>> end if
>
>http://www.oofile.com.au/downloads.html#DownloadREALbasic
>
>contains the PrintMasking sample which shows zooming with a scrolling window.
>_______________________________________________
>Unsubscribe or switch delivery mode:
><http://www.realsoftware.com/support/listmanager/>
>Search the archives:
><http://support.realsoftware.com/listarchives/lists.html>