Home > Archive > Visual Basic > August 2005 > Margin on PrintForm
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Margin on PrintForm
|
|
| Marv Wade 2005-08-30, 6:55 pm |
| I am printing the form that is displayed using the PrintForm method. Prints
the form OK located to the top left of the paper. Now I want to center the
form on the printout. The help file says to use the following statements to
do this, but it does not have any effect on the location of the form on the
paper when printed - it still prints at the top left of the paper.
Printer.ScaleLeft = -((Printer.Width - frmCalculate.Width) / 2)
Printer.ScaleTop = -((Printer.Height - frmCalculate.Height) / 2)
PrintForm
Printer.EndDoc
The Scale Left positions calculates to 2137.5 and the ScaleTop calculates to
2355
What am I missing?
Marv
PrintForm
| |
|
|
"Marv Wade" <NG@columbus.rr.com> wrote in message
news:ubCO29YrFHA.528@TK2MSFTNGP09.phx.gbl...
>I am printing the form that is displayed using the PrintForm method.
>Prints the form OK located to the top left of the paper. Now I want to
>center the form on the printout. The help file says to use the following
>statements to do this, but it does not have any effect on the location of
>the form on the paper when printed - it still prints at the top left of the
>paper.
>
> Printer.ScaleLeft = -((Printer.Width - frmCalculate.Width) / 2)
> Printer.ScaleTop = -((Printer.Height - frmCalculate.Height) / 2)
> PrintForm
> Printer.EndDoc
>
> The Scale Left positions calculates to 2137.5 and the ScaleTop calculates
> to 2355
>
> What am I missing?
Probably nothing. PrintForm is extremely restrictive and problematic
(PrintForm doesn't actually use or recognize any settings to the Printer
object because essentially it doesn't use the Printer object as it's
"hard-coded" to just print to the default printer). See the following KB
articles for several much better ways to print your form:
How To Print a Form That Is Too Large for the Screen or Page
http://support.microsoft.com/defaul...kb;en-us;230502
How To Print Using Custom Page Sizes on Windows NT and Windows 2000
http://support.microsoft.com/defaul...kb;en-us;282474
How To Capture and Print the Screen, a Form, or Any Window
http://support.microsoft.com/defaul...kb;en-us;161299
PrintForm has many known bugs and problems associated with it. Some of these
have been fixed and/or addressed. Some have not. In any case, the best
thing is to just forget there even is a PrintForm method and use the code
from one of the above KB articles.
--
Mike
Microsoft MVP Visual Basic
| |
| Marv Wade 2005-08-30, 9:55 pm |
| Mike, I tried the method outlined in the last of the three references you
provided. Two problems. First, it takes 15-20 seconds for the picture to
get to the printer. Secondly, I could not get the routine to print the form
at the same size - it always took the entire page. Since I have never tried
this before there is obviously something I'm missing, but the time delay
makes it not suitable for what I am attempting to do.
Thanks for the input.
Marv
"MikeD" <nobody@nowhere.edu> wrote in message
news:%23HEWr%23arFHA.3836@TK2MSFTNGP12.phx.gbl...
>
> "Marv Wade" <NG@columbus.rr.com> wrote in message
> news:ubCO29YrFHA.528@TK2MSFTNGP09.phx.gbl...
>
>
> Probably nothing. PrintForm is extremely restrictive and problematic
> (PrintForm doesn't actually use or recognize any settings to the Printer
> object because essentially it doesn't use the Printer object as it's
> "hard-coded" to just print to the default printer). See the following KB
> articles for several much better ways to print your form:
>
> How To Print a Form That Is Too Large for the Screen or Page
> http://support.microsoft.com/defaul...kb;en-us;230502
>
> How To Print Using Custom Page Sizes on Windows NT and Windows 2000
> http://support.microsoft.com/defaul...kb;en-us;282474
>
> How To Capture and Print the Screen, a Form, or Any Window
> http://support.microsoft.com/defaul...kb;en-us;161299
>
>
> PrintForm has many known bugs and problems associated with it. Some of
> these have been fixed and/or addressed. Some have not. In any case, the
> best thing is to just forget there even is a PrintForm method and use the
> code from one of the above KB articles.
>
>
> --
> Mike
> Microsoft MVP Visual Basic
>
>
| |
|
|
"Marv Wade" <NG@columbus.rr.com> wrote in message
news:ed83glcrFHA.1984@tk2msftngp13.phx.gbl...
> Mike, I tried the method outlined in the last of the three references you
> provided. Two problems. First, it takes 15-20 seconds for the picture to
> get to the printer. Secondly, I could not get the routine to print the
> form at the same size - it always took the entire page. Since I have never
> tried this before there is obviously something I'm missing, but the time
> delay makes it not suitable for what I am attempting to do.
>
Don't know what to tell you then. I didn't write those KB articles or the
code in them. Perhaps you can study the code and tweak it to improve
performance as well as meet your needs. Not everything's going to be handed
to you on a silver platter. Usually, you gotta put in some effort of your
own. I provided those KB articles as reference material only. You said you
only tried the last one. Did you try anything from the other 2? If not, you
probably should.
--
Mike
Microsoft MVP Visual Basic
|
|
|
|
|