printform messes with zorder!

t3hpimpz0r

New member
Joined
Aug 19, 2010
Messages
2
Programming Experience
Beginner
I'm having a really annoying issue.

I have a form that has several panels on it, and the innermost panel has a picturebox in it with a few labels on top. It looks fine when I look at the form.

When I use the printform control to print the form, however, for some dumb reason the picturebox gets sent to the front and it covers all the labels! Even if do picturebox1.sendtoback right before I call the print method, it's still on top. It's so frustrating! Just stay back there, please.

I realize that I have the option to draw an image of the form and print that, but unfortunately this program is massive and that makes it take so much longer. Also, I need this to pretty much open a form, print it, and close it really fast. My attempts at capturing the image of the form have been unsuccessful because the form loads only halfway, the 'document is being sent to printer....' dialog pops up from windows, that gets captured along with the partially loaded form, and then that jumbled mess is printed. Also, other forms are constantly coming forward and stuff, so capturing the screen isn't full proof at all. The printform would be absolutely perfect if it just didn't screw with my zOrder. Please tell me someone has a solution.

Thanks.
 
I can't find it now but I'm fairly sure that I've read something about the PrintForm component printing controls in reverse z-order. I'm not sure of the logic behind that, other than it's supposed to work like the VB6 PrintForm method, but, if that's true, then the obvious solution is to change the z-order of your controls first, print, then change the z-order back again. You should try calling BringToFront on the PictureBox before printing and then SendToBack afterwards.
 
I can't find it now but I'm fairly sure that I've read something about the PrintForm component printing controls in reverse z-order. I'm not sure of the logic behind that, other than it's supposed to work like the VB6 PrintForm method, but, if that's true, then the obvious solution is to change the z-order of your controls first, print, then change the z-order back again. You should try calling BringToFront on the PictureBox before printing and then SendToBack afterwards.

I love you. <3.

This completely worked and solved all of my issues. I feel like it should have some sort of disclaimer, "This responds opposite of how you think it should."

Thank you.
 
Back
Top