Groups | Blog | Home
all groups > vb.net upgrade > april 2005 >

vb.net upgrade : DrawLine Code Draws Box



Lila Godel
4/14/2005 11:42:25 PM
I am migrating my VB6 GoldMine add-ons to VB.NET to allow for
enhancements. I have no problem getting text to print, but I cannot get the
4 PrintPage events that are needed to print a line to work.

I need a line that has a width of 5 that starts 3.797 inches from the top
edge of the paper, starts 0.613 inches from the left edge of the paper and
ends at the edge of the paper so I know where to trim the paper for proper
insertion in a form envelope. When one of the PrintPage events executes I
get a large solid black box that covers up the printed text below which the
line is supposed to print. In VB6 I used the code

'spool end of fly slip marker
Printer.CurrentX = 0.613
Printer.DrawWidth = 5
Printer.Line (0.613, 3.797)-(8.5, 3.797)

with the ScaleMode set to inches by a special subrountine that makes the
values of .CurrentX and .CurrentY be from the edge of the paper not the
start of the printable area.

In VB.NET I am using the code

'define variables
Dim fontRA = New Font(conCfgInfo.strTypeFaceRA, conCfgInfo.intFontSizeRA)
Dim fontA = New Font(conCfgInfo.strTypeFaceA, conCfgInfo.intFontSizeA)
Dim pen As New Drawing.Pen(System.Drawing.Color.Black, 5)
Dim strAddress As String
Dim strReturnAddress As String

'create return address
....

'create address
....

'change unit of measure for printing
e.Graphics.PageUnit = GraphicsUnit.Inch

'print return address
e.Graphics.DrawString(strReturnAddress, fontRA, Brushes.Black, 0.613, 0.826)

'print address
e.Graphics.DrawString(strAddress, fontA, Brushes.Black, 0.613, 2.28)

'print end of fly slip marker
e.Graphics.DrawLine(pen, 0.613F, 3.797F, 8.5F, 3.797F)

with

the margins set to 0 in the BeginPrint Event

If I remove the letter F after each number in the DrawLine code an error
that prevents building the solutions results.



Herfried K. Wagner [MVP]
4/18/2005 12:00:00 AM
"Lila Godel" <lila@godel.com> schrieb:
[quoted text, click to view]

Please avoid multiposts (posting the same message to more than one group
separately) in future.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
AddThis Social Bookmark Button