473,419 Members | 1,635 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Graphics.DrawString method pops an exception 2nd time I PrintPrevi

Hi, I'm trully excited to use VB.NET's PrintDocument to make my printouts. On
them I draw strings, images and lines.

All perfect, if I invoke the Print or the PrintPreview one time per run.

At second time I onvoke print or preview, the DrawLine or DrawImage go well,
but the first DrawString the program tries to execute pops an exception:

************** Exception Text **************
System.ArgumentException: Invalid parameter used.
at System.Windows.Forms.PrintPreviewControl.Calculate PageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallba cks()
************** Loaded Assemblies **************
mscorlib
(and so on...)

I already checked the content of my DrawString instruction and all the
parameters at the second time have the same values, except the handle number
where objects were new.

Please note that the problem emerges at the second time I try to print or
printpreview, not at the second page of a multiple page printout.

Help please.
--
Joao Braganca

Nov 23 '05 #1
1 1965
Update:

I only have this problem if I use the DrawLine method. When I use the
DrawString and the DrawImage, there's no error at the second time I Print or
PrintPreview.

There's something wrong when I mix DrawString and DrawLine that causes
DrawString to fail the second time.
--
Joao Braganca

"Joao" wrote:
Hi, I'm trully excited to use VB.NET's PrintDocument to make my printouts. On
them I draw strings, images and lines.

All perfect, if I invoke the Print or the PrintPreview one time per run.

At second time I onvoke print or preview, the DrawLine or DrawImage go well,
but the first DrawString the program tries to execute pops an exception:

************** Exception Text **************
System.ArgumentException: Invalid parameter used.
at System.Windows.Forms.PrintPreviewControl.Calculate PageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallba cks()
************** Loaded Assemblies **************
mscorlib
(and so on...)

I already checked the content of my DrawString instruction and all the
parameters at the second time have the same values, except the handle number
where objects were new.

Please note that the problem emerges at the second time I try to print or
printpreview, not at the second page of a multiple page printout.

Help please.
--
Joao Braganca

Nov 23 '05 #2

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

Similar topics

1
by: DrDevious | last post by:
Maybe I am doing something wrong but has anyone else here noticed a difference in the positioning of text between the Graphics.DrawString method and the Win32 GDI DrawText function? My text is...
0
by: twostepted | last post by:
Hello, This is a bit of a long post (sorry) but here is the jist of it: I've developed a Windows forms User Control marquee (auto-scrolling text like a readerboard). I'm trying to optimize it...
5
by: Charles A. Lackman | last post by:
Hello, I have created a complete PrintDocument and need to create an image from it. How is this done? e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality...
2
by: Kalvin | last post by:
I keep getting my string inside a black box with this code. I would like to make the background transparent. Any help on this will be appreciated very much. '**** BEGIN CODE **** Try Dim...
7
by: Michael Galvin | last post by:
I am trying to use Python to send to the printer a calender filled with a mix of text and simple graphics. I want to draw on the printed page something like a table with 6 rows and 7 columns to...
7
by: Peter Row | last post by:
Hi, I've started work on my own control some parts of which use standard controls, others I need to draw on my controls surface to get the display output I require, however.... I seem to be...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
2
by: drsmooth | last post by:
Hi, i have made several different things using a double buffer and a jframe before but never had this problem: if you look thrugh the code, you can see that i draw a whole bunch of stuff to the...
10
by: anuking | last post by:
Hi, I made a tool that compares the texts from 2 richtextboxes and then marks the characters that are different in red. An option needs me to overlap these 2 text data to show the exact...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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...

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.