Printing every other listbox item as transparent grey

This is on my mac version… I want to print the contents of the list box with every other line having a slight grey box.

[code]  if greybox=true then
    page.ForeColor= &cC3C1C1
  end if[/code]

it’s not really working that well - instead of printing a slightly transparent grey background I get a solid grey box - any ideas?

Maybe transparency is not supported for printing?

That’s an unusual way to alternate lines. Do you not have some sort of line number at this place in code? Then it’s just

if lineNumber Mod 2 = 1 then //fill line background end

As to the actual problem, what are gap1 and gap? It’s possible these are filling more than you think, particularly if ‘gap’ is increasing. With a lineNumber variable (starting at 0) it’d look like this, basically that last height parameter is constant.

g.FillRect(0, lineNumber*rowHeight+topOffset, width, rowHeight)

This could be shortened to:

If greybox Then page.ForeColor = &cC3C1C1 page.PenHeight = 0 page.Transparency = 0.8 page.FillRect(0, (gap1 * 20) + 65, 800, (gap * 20) + 20) End greybox = Not greybox
But personally I also use the Modulo approach Will has posted.

It works well enough - it’s the transparency with printing that’s the problem.
Gap is simply the amount of line spaces dependant on how many lines are in the the list item.
Grey box is a boolean which alternates.


I have two very stupid questions: why using transparency ?

And… where do you print the text ?

In a project, I print a light grey background rect (one line with, one line without) and in an alternate print, I print the ListBox color background (more complex: four possible background colors).

The first problem was resolved by printing the text SECOND, while the second problem was an error of mine: for some stupid reason, I enlarged the height value used to print the color background line…

But I do not think at transparency (in printing).

Oh I misunderstood. I thought the alternating boxes were filling the page but I see the issue is just opaqueness. [quote]page.Transparency=0.80[/quote]
It’s not [0->1] transparent->opaque, it’s [0->100] opaque->transparent.

I don’t know if this applies here, but I had noticed in the past that printers sometimes need blocks of color or pictures to be sent to the printer BEFORE Text, otherwise text does not show.