In response to my own question...
I did it the hard way, trial and error 1000 times and using a select case to set the exact x position of each new column
Not Elegant - but it works.

for x = 0 to ListBox1.ListCount - 1
        for y = 0 to ListBox1.ColumnCount - 1

        select case y
        case 0
                xpos = 0
        case 1
                xpos = 100
        case 2
                xpos = 175
        case 3
                xpos = 225
        case 4
                xpos = 250
        .
        .
        .

        g.DrawString ListBox.Cell(x, y), xpos, (x*h)+h

        next
next


Regards,
Stephen


On 4-Jul-06, at 7:04 PM, Stephen wrote:

Hi
I'm trying to print out the contents of a ListBox. I found some good examples on the net for doing the output. I figured out that you can help the user choose landscape by popping up the PageSetupDialog.

The problem I'm having now is cellspacing. All of the examples I've encountered assume that all columns are equal width and do something like:

w = g.Width / ListBox.ColumnCount

then they (I) do a DrawString using nested for loops and setting DrawString's X to be (y*w) which sets every field to be exactly the same width, with an incrementing y being the multiplier of w sort of like this:

  for x = 0 to ListBox.ListCount-1
    for y = 0 to ListBox.columnCount-1
      g.DrawString ListBox.cell(x,y), (y*w), (x*h)+h
    next
  next

(I haven't included the Dims for all vars in this example obviously)


The resulting Print Preview on OS X Tiger is a mess of overlapping cell content. Some fields are text strings of about 30 chars and some are price fields of about 6 chars. I'm just wondering if anyone has an elegant and wonderful way of cleaning this up, and making me look like a hero?

Thanks in advance!


Best Regards,
Stephen
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to