473,465 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DrawLine Code Draws Box

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.
Nov 21 '05 #1
0 1190

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jon Cosby | last post by:
I'm using this to draw rectangles in a PictureBox image. Not all of the rectangles are complete, and after drawing several, some of them start disapearing. What's the reason for this? Pen...
1
by: Rich | last post by:
Hello, I am trying to draw a graph on a form. I can draw the box using drawline, and bars inside the box using drawrectangle, but when I try to draw a line inside the box the inner lines are...
4
by: Smoke | last post by:
It is possible to draw a line on a control using AA? basically, i need the normal .DrawLine funcion but that support antia aliasing. is this possible? can somebody tellme how? Thanks for the...
2
by: John | last post by:
I created a number of pictureboxes in a panel, and want to draw lines in those pictureboxes but I cannot. Please see the following code and make corrections. Thanks. Private Sub...
2
by: Stu | last post by:
Hi, Why does the code below only draw the last line of the loop? I was expecting this to draw 10 parallel lines. More to the piont....how do I get it to draw 10 parallel lines? Public...
3
by: Ben Bush | last post by:
I had the following code and when I clicked the left mouse button one time. I got green line and the second click got a purple line and the green disappeared. I was confused by two questions:...
8
by: sabirah | last post by:
My code does not seem to be working properly... The game is b/w a human and the computer. The computer always goes first. The computer chooses the first corner in the first turn. in the comp's...
2
by: intrepid_dw | last post by:
All I am writing a C# WinForms application which is giving me some problems. The application consists of a form containing an empty Tab control to which TabPages are added dynamically (at...
2
by: RichGK | last post by:
This is from http://msdn2.microsoft.com/en-us/library/aa287522(VS.71).aspx public MainForm() { InitializeComponent(); System.Drawing.Pen myPen;
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.