Re: VB Printer Dialog Problem (VB6)
- From: andy.vandierendonck@xxxxxxxxxx
- Date: 2 Jul 2006 08:46:25 -0700
Okay, I'll try to make it clear.
What I print is an orderticket to rent products.
But that order ticket is more like a contract, so many
conditions must be print on that orderticket. It also
is possible to print it in 2 different languages, dutch and
french. So this means that some of the text will be larger or
smaller, deppends on the selected language.
Most of the text that will be printed is set at design time,
like conditions. But somewhere in the middle of the text
there's also data printed of the selected customer, such like,
Name, Company, Address ... Because the data of the customer
is always different, there will be always a different text width and
also a different text height, and that's because I use a WordWrap
function that I've made to measures the text width, and breack
the words if the text width is larger than the given width for one
line.
Example: (Customers is a 2 dimensional array)
In my bas module:
Private Type CustomersType
Name As String
Company As String
Streetname_and_number As String
End Type
Public Customers() As CustomersType
Public Customers_EOF As Integer
---
In the form, for example record of customer = 56
Text width for one line is 187mm:
Dim CustomerStr As String
With Customers(56)
CustomerStr = .Name + ", " + .Company + ", " _
+ .Streetname_and_number
End With
With Printer
.Print WordWrap("This is an example with " _
+ "customerdata wich is, " + CustomerStr _
+ ". After that the text continues.", 187)
End With
---
Another thing I use is a table with an overview of all
products to rent. Such like Discription, Price/Piece, Qty,
Total. The height of that table depends on how many products
the user has added to the orderticket. The user can also add free text
inside that table, and the lenght is unlimited. So I use also my
WordWrap function for the discription inside the table. To draw the
table
I use the Printer.Line statement to draw the rectangles inside that
table, wich I've learned now thanks to this topic to do it right.
Before the next product will print inside the table I first check if
the
text height for the discription is not to large to print it on the same
page.
I set the limit of the bottom margin of the page to 275mm.:
Syntax: With Printer
If .CurrentY + .TextHeight(WordWrap(DiscriptionStr, 127)) > 275 Then
.NewPage
'
' Draw the table again on the next page and resume printing with
' the products.
End if
And this goes on over the whole order ticket. Always checking if the
text height or the height of rectangles is not to large to print it on
the same page. So that's why I'll never know how many pages there
will be print.
I hope that I now gave enough information to explain what I'm printing.
Otherwise, shame on me.
Andy
.
- Follow-Ups:
- Re: VB Printer Dialog Problem (VB6)
- From: Mike Williams
- Re: VB Printer Dialog Problem (VB6)
- From: Mike Williams
- Re: VB Printer Dialog Problem (VB6)
- From: Mike Williams
- Re: VB Printer Dialog Problem (VB6)
- From: Mike Williams
- Re: VB Printer Dialog Problem (VB6)
- From: Mike Williams
- Re: VB Printer Dialog Problem (VB6)
- References:
- Re: VB Printer Dialog Problem (VB6)
- From: andy . vandierendonck
- Re: VB Printer Dialog Problem (VB6)
- From: Mike Williams
- Re: VB Printer Dialog Problem (VB6)
- Prev by Date: Re: Rich text boxes - stopped working
- Next by Date: Re: object data type
- Previous by thread: Re: VB Printer Dialog Problem (VB6)
- Next by thread: Re: VB Printer Dialog Problem (VB6)
- Index(es):
Relevant Pages
|