Windows Develop Bookmark and Share   
 index > Windows Forms General > Maximum array size in Graphics.DrawLines?
 

Maximum array size in Graphics.DrawLines?

Although there is no indication of it in the help files, I find that the program freezes when I send a curve to my printer by means of the command "graphics.DrawLines(pen, Point[])" when the array Point[] is too large. I do this in the normal way, by writing with this command on a PrintDocument, then printing. Is it a matter of the particular printer (I am using an hp 3650)? [When it does freeze, it is a nuisance to free it again: I need to stop the Windowx XP spooling service and reboot!]

I am in the process of trying to find out what the maximum size is; at this point I know that 300000 is too much.

prog.gabi  Wednesday, January 30, 2008 7:58 PM

I am answering my own query, because I found the solution and feel that others may profit from it.

The problem is in lack of memory, probably in the printer. The solution is to write a subroutine which sends the array of points in small pieces; for example, I break up my original array of >300000 point structures into arrays of no more than 500 (that is what I did in my case).

It is important to overlap the individual subarrays by 1, since it is the first two points that define the first section of line. As I see it, the printer driver can handle 500 line segments at a time easily, but chokes somewhere between 500 and 300000, I don't care exactly where (and don't care).

prog.gabi  Friday, February 01, 2008 6:06 PM

I am answering my own query, because I found the solution and feel that others may profit from it.

The problem is in lack of memory, probably in the printer. The solution is to write a subroutine which sends the array of points in small pieces; for example, I break up my original array of >300000 point structures into arrays of no more than 500 (that is what I did in my case).

It is important to overlap the individual subarrays by 1, since it is the first two points that define the first section of line. As I see it, the printer driver can handle 500 line segments at a time easily, but chokes somewhere between 500 and 300000, I don't care exactly where (and don't care).

prog.gabi  Friday, February 01, 2008 6:06 PM

You can use google to search for other answers

Custom Search

More Threads

• Integrating .NET 1.1 with Visual Studio 2002?
• webform app,navigation controls
• Timer problem
• Copy TreeView items checked states from treeview to another ??
• Focus in application started remotely
• net1.0 to net 1.1
• Trying to work with MSCommLib
• Calling an Control With a String. Can it be done?
• Cannot Updated!
• How to change the color of the scroll bar in the Datagridview? VB.Net or VS2005(VB)