Home All Groups Group Topic Archive Search About

Printing Blank lines for Top margin

Author
19 Oct 2005 7:20 PM
Guillermo
Gentlemen, a simple question.
My MDI Child Forms are being printed close to the top edge of the paper.
How do I order the printer to write a couple of blank lines for a Top margin?.
Top, Scale Properties don't seem to work. Thanks. Guillermo.

Author
19 Oct 2005 8:11 PM
Veign
MDIChild forms being printed?  How you are you printing MDI child forms?

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


Show quoteHide quote
"Guillermo" <Guille***@discussions.microsoft.com> wrote in message
news:9698BB06-1C3B-491E-A9F4-AD758F98D50D@microsoft.com...
> Gentlemen, a simple question.
> My MDI Child Forms are being printed close to the top edge of the paper.
> How do I order the printer to write a couple of blank lines for a Top
> margin?.
> Top, Scale Properties don't seem to work. Thanks. Guillermo.
Author
19 Oct 2005 9:12 PM
MikeD
"Veign" <NOSPAMinveign@veign.com> wrote in message
news:Oh5FknO1FHA.2932@TK2MSFTNGP10.phx.gbl...
> MDIChild forms being printed?  How you are you printing MDI child forms?


You sound as if you find this miraculous (or undoable).  <g>


--
Mike
Microsoft MVP Visual Basic
Author
19 Oct 2005 8:53 PM
Mike L
"Guillermo" <Guille***@discussions.microsoft.com> wrote:
> Gentlemen, a simple question.
> My MDI Child Forms are being printed close to the top edge of the paper.
> How do I order the printer to write a couple of blank lines for a Top
margin?.
> Top, Scale Properties don't seem to work. Thanks. Guillermo.

If your program is a word processor, then the below link should help:

http://support.microsoft.com/default.aspx?scid=kb;en-us;146022
Author
19 Oct 2005 9:16 PM
MikeD
"Mike L" <pillowpc2***@paonline.com> wrote in message
news:%23fOQ48O1FHA.2212@TK2MSFTNGP15.phx.gbl...
> "Guillermo" <Guille***@discussions.microsoft.com> wrote:
>> Gentlemen, a simple question.
>> My MDI Child Forms are being printed close to the top edge of the paper.
>> How do I order the printer to write a couple of blank lines for a Top
> margin?.
>> Top, Scale Properties don't seem to work. Thanks. Guillermo.
>
> If your program is a word processor, then the below link should help:


Why would the program have to be a word processor? That link just pertains
to a RichTextBox. That doesn't mean the app is a word processor.

--
Mike
Microsoft MVP Visual Basic
Author
19 Oct 2005 9:02 PM
MikeD
"Guillermo" <Guille***@discussions.microsoft.com> wrote in message
news:9698BB06-1C3B-491E-A9F4-AD758F98D50D@microsoft.com...
> Gentlemen,

How do you know there aren't ladies reading your post?  <g>

> a simple question.
> My MDI Child Forms are being printed close to the top edge of the paper.
> How do I order the printer to write a couple of blank lines for a Top
> margin?.
> Top, Scale Properties don't seem to work. Thanks. Guillermo.

Explain what you mean by "don't seem to work".  That doesn't help us
understand the problem at all. What is your code?  How are you printing
these MDI child forms?  Are you using the PrintForm method?  My guess is
that you are.  If so, PrintForm doesn't give you much (any) control over
anything.  You might want to take a look at the following KB article:

How To Capture and Print the Screen, a Form, or Any Window
http://support.microsoft.com/default.aspx?scid=kb;en-us;161299


--
Mike
Microsoft MVP Visual Basic
Author
19 Oct 2005 11:26 PM
Guillermo
Thanks for all who answered my question.
Yes, I'm using PrintForm.
Form9.BackColor = &HFFFFFF  'in order not to use all the Ink cartridge.
Form9.PrintForm

My application screens are designed to be printed for documents and reports
(A4).
I just need the printer to advance a couple of lines in order to leave a top
margin.
Reading the article now. Thanks. Guillermo. Buenos Aires, Argentina.
BTW, Gentlemen is the proper salutation in my old English Textbook. Love to
see ladies around though. I'm Latin, see?. :-)


Show quoteHide quote
"MikeD" wrote:

>
> "Guillermo" <Guille***@discussions.microsoft.com> wrote in message
> news:9698BB06-1C3B-491E-A9F4-AD758F98D50D@microsoft.com...
> > Gentlemen,
>
> How do you know there aren't ladies reading your post?  <g>
>
> > a simple question.
> > My MDI Child Forms are being printed close to the top edge of the paper.
> > How do I order the printer to write a couple of blank lines for a Top
> > margin?.
> > Top, Scale Properties don't seem to work. Thanks. Guillermo.
>
> Explain what you mean by "don't seem to work".  That doesn't help us
> understand the problem at all. What is your code?  How are you printing
> these MDI child forms?  Are you using the PrintForm method?  My guess is
> that you are.  If so, PrintForm doesn't give you much (any) control over
> anything.  You might want to take a look at the following KB article:
>
> How To Capture and Print the Screen, a Form, or Any Window
> http://support.microsoft.com/default.aspx?scid=kb;en-us;161299
>
>
> --
> Mike
> Microsoft MVP Visual Basic
>
>
>
Author
20 Oct 2005 10:49 AM
Mike Williams
"Guillermo" <Guille***@discussions.microsoft.com> wrote in message
news:A624EE6D-C835-4378-A4E8-5D1A28221B89@microsoft.com...

> Reading the article now. How to print a window . . .]

I wouldn't bother if I were you :-)

You really would be far better off treating the screen as a screen and
treating the printer as a printer. Don't mix the two. The printer (unlike
the screen) is capable of very high resolution output and you will get
professional looking reports and documents if you use it properly. Check out
the VB Printer Object and its various methods (including Line, Circle,
Print, PaintPicture, etc, etc).

Mike
Author
20 Oct 2005 4:03 PM
Guillermo
Too late, Mike. Already read it and got no tips from it. :-(
I AM using the VB Printer Object.
The Form is printed fine, but leaves no top margin.
Printer is NOT obbeying the Printer.Current Y order.
Form9.ScaleMode = 0   'User Mode
Printer.CurrentY = 400
Form9.BackColor = &HFFFFFF
Form9.PrintForm

Just for a test, I've tried printing a Line (0,0)-(200,200) and nothing
happens, either.
Is it my Deskjet HP printer's fault??.
Thanks. Guillermo.

Show quoteHide quote
"Mike Williams" wrote:

> "Guillermo" <Guille***@discussions.microsoft.com> wrote in message
> news:A624EE6D-C835-4378-A4E8-5D1A28221B89@microsoft.com...
>
> > Reading the article now. How to print a window . . .]
>
> I wouldn't bother if I were you :-)
>
> You really would be far better off treating the screen as a screen and
> treating the printer as a printer. Don't mix the two. The printer (unlike
> the screen) is capable of very high resolution output and you will get
> professional looking reports and documents if you use it properly. Check out
> the VB Printer Object and its various methods (including Line, Circle,
> Print, PaintPicture, etc, etc).
>
> Mike
>
>
>
>
>
Author
20 Oct 2005 5:33 PM
Mike Williams
"Guillermo" <Guille***@discussions.microsoft.com> wrote in message
news:C7F77CB0-FEDD-4E7F-A2A3-CA85F7E18746@microsoft.com...

> I AM using the VB Printer Object. The Form is printed
> fine, but leaves no top margin.

Using the PrintForm method is *not* the same as using the VB printer object.
PrintForm dumps a graphic of your Form to the page and then closes the print
job. It takes no notice whatsoever of the printer object or any of its
settings. Also (as you've discovered) you have no control whatsoever over
the location of the printout.

> Just for a test, I've tried printing a Line (0,0)-(200,200)
> and nothing happens, either.

I'm not sure what you mean by "nothing happens". Does a page get ejected, or
does the printer do nothing at all? Don't forget that the line (by default)
is just one pixel wide, and one pixel on a 1200 dots per inch printer is
almost invisible! Try this (paste it into a new VB Form containing a Command
Button):

Option Explicit
Private Declare Function GetDeviceCaps Lib "gdi32" _
(ByVal hdc As Long, ByVal nindex As Long) As Long
Private Const PHYSICALOFFSETX As Long = 112
Private Const PHYSICALOFFSETY As Long = 113

Private Sub SetPrinterOrigin(x As Single, y As Single)
With Printer
  .ScaleLeft = .ScaleX(GetDeviceCaps(.hdc, PHYSICALOFFSETX), _
    vbPixels, .ScaleMode) - x
  .ScaleTop = .ScaleY(GetDeviceCaps(.hdc, PHYSICALOFFSETY), _
    vbPixels, .ScaleMode) - y
  .CurrentX = 0
  .CurrentY = 0
End With
End Sub

Private Sub Command1_Click()
Printer.ScaleMode = vbInches
SetPrinterOrigin 0, 0 ' top left corner of physical page
Printer.DrawWidth = Printer.ScaleX(0.01, vbInches, vbPixels)
Printer.Line (1, 1)-(2, 2), vbBlack, B
Printer.EndDoc
End Sub

When you click the button the printer should produce a page containing a "1
inch" square positioned so that its top left corner is exactly 1 inch from
the left and 1 inch from the top of the page and the thickness of the line
used for the square should be one hundredth of an inch.

Does that work okay on your system? (Post back whether it does or it doesn't
so that I will know if you appear to have a problem and perhaps figure out a
solution for you).

Mike