|
-
Jun 19th, 2000, 05:07 PM
#1
Thread Starter
Junior Member
Guys,
Help needed badly !!!
I am very very new to programming and visual basic is the
first i have been studying by myself. I purchased a book
authored by Evangelos Petrutsos named "Mastering Visual
Basic 6". In the book, he explained all about the common
dialogue control and how you can print document to it.
But what is missing is, he did not wrote any sample on
how to print the form itself (form1.picture) that contained
pictures. How do i go about it?
Right now, i am writing a program that my wife can actually
use and it requires printing the text and the background
picture.
Please help me !!!
Maverick_X2000
BTW: How do i resize the form and the msflexgrid will auto
matically resize itself according to the form's dimension?
Thank you very much !!!
-
Jun 19th, 2000, 06:18 PM
#2
Addicted Member
To see how to print a Form look up "PrintForm" in VB Help.
To use the following example put a PictureBox on a new form
and load a graphic into it's Picture Property, then put a
Command Button on the Form, name it cmdPrintWithBtn and code it as follows:
Code:
Private Sub cmdPrintWithBtn_Click()
'Print (3) spaces at the top of the page
Printer.Print: Printer.Print: Printer.Print
'Picture1 can be any type graphic, .ico; bmp; etc.
'however it must be on the form as a Picture Box
'object.
'Print the Picture at x=3050;y=1050
Printer.PaintPicture Picture1.Picture, 3050, 1050
Printer.CurrentY = 700
Printer.CurrentX = 6000
'Print (4) spaces below the Top of the Page-not the Picture
Printer.Print: Printer.Print: Printer.Print: Printer.Print
With Printer
.Font.Name = "MS Serf" 'Use a True Type Font
.Font.Size = 14
.Font.Bold = True
.Font.Italic = False
.Font.Underline = False
End With
'***************************
Printer.Print
Printer.Print
Printer.Print , " ***A TYPICAL PAGE HEADER*** "; Date$
Printer.Print , "_______________________________________________________________________"
'Set up a new font - System -Not a True Type Font, in case
'user does not have True Type Fonts installed
With Printer
.Font.Name = "System"
.Font.Size = 14
.Font.Bold = True
.Font.Italic = True
.Font.Underline = True
End With
Printer.Print
Printer.Print Tab(15); "Project: Test Print Test Project"
Printer.Print
Printer.Print Tab(15); "Now is the time for all good men to come to the"
Printer.Print
Printer.Print Tab(15); "aid of their country."
Printer.Print: Printer.Print: Printer.Print
Printer.EndDoc
End Sub
You should look up the "Scale Mode" property in VB help to
learn about pixels,twips, etc., there are 1440 twips to an
inch and the graphic in the code above is printed in twips.
Also, look up Current X and Current Y in VB Help.
Good Luck.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|