Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print entire form including off screen 1

Status
Not open for further replies.

bbuk

Technical User
Apr 27, 2002
44
GB
Hi

I have an application which displays the results from a vehicle diagnostic machine. I use the Innovasys FramePlus control as a container for several shape controls to represent the status of the leds on the machine. To produce the printout I have an invisible form with a standard frame containing labels for the customer information, then 2 x FramePlus controls to show the before and after state of the leds. I then print this form using Form.Print. Everything prints perfectly on my system.

Now to my problem - I have found, like many before me I now realise, that when the form is printed on a system with a lower screen resolution only the part of the form which would be on the screen were it visible is printed.

After much searching I have not found a solution which fits my situation,can anybody here please help me out of this hole which I have dug for myself?

Andy
 
Can you get the screen resulution of the computer and compare that to yours and adjust your controls and form accordingly?
 
Thanks for the replies.

CaptainD I think this would work but if I resize the form for the worst case resolution (800x600) the printed output would be too small.

Strongm, thanks for pointing me to the PrintWindow api but but I still have some problems. One is that I can't get it to only capture the client area. As far as I can find the PW_CLIENTONLY constant is 1 but even using 1 for the flag the entire window is captured.

I found that I cant place the captured image directly on the printer object hDC but if I place it on a picturebox I can then print the picturebox image with printer.paintpicture (thanks to hypetia in thread 922-912111). Unfortunately this does not solve the original problem - the part of the picturebox which is off the screen is not printed.

Any further help or suggestions gratefully received...
 
Ah - you just want the client area ... sorry, but there's a bug (as you have discovered) in PrintWindow when using the PW_CLIENTONLY flag

>cant place the captured image directly on the printer object hDC

Should be able to. You may need to select a bitmap into the printer's hDC first though.
 
You might try setting your form as a MDIchild. That way it can be bigger than the screen resolution and Printform will print the whole thing.

Robert
 
Thanks Robert - that does exactly what I need. Is there a downside, something this easy must have a downside!

strongm - Thanks for the suggestion but Roberts answer seems easier for my purpose. For future reference what do you mean by select a bitmap into printers hDC?

Andy
 
Your welcome. Glad it helped. I don't know of any downside right off the top of my head.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top