Pdf background

Hello,
I tried to find the answer but didn’t see anything. Is there a way to insert a background color to a section of a PDF Document. I tried to do fillrectangle but it didn’t work. I am trying to get something like this:


you used a .DrawingColor
and .Transparency = 0.0 (opaque)

or wrong coordinates?

use a break point and see that your methods are called.

I tried doing this:

vAltline = 1

while not rs.AfterLastRow

vName = rs.Column(“Name”).StringValue
vUser = rs.Column(“User”).StringValue
vPass = rs.Column(“PassW”).StringValue
Retval = DESDecrypt(vPass, v64BitKey)

If vAltline = 1 then
vAltline = 0
g.DrawingColor=Color.Gray
//g.Transparency = 0.0
g.FillRectangle 20, vRowPos-15, 550, vRowPos+5
else
vAltline = 1
end if

g.DrawText(vName, 20, vRowPos)
g.DrawText(vUser, 250, vRowPos)
g.DrawText(RetVal, 450, vRowPos)
etc…

(I use vAltline to try to paint every other line but I am definitely missing something

But got this

If I try to use transparency, I get the error “Graphics object cannot be used outside its Paint event”

Gray on Gray :wink:
you forgot textcolor?

g.DrawingColor=Color.Black
g.DrawText(vName, 20, vRowPos)
g.DrawText(vUser, 250, vRowPos)
g.DrawText(RetVal, 450, vRowPos)

you can also use
a=1-a
to toggle a value

Excellent Markus, that did it :roll_eyes: thank you for your help