PrintPreviewControl / PrintPreviewDialog: Image location within the client area

  • Thread starter Thread starter Ramsey Schaffnit
  • Start date Start date
R

Ramsey Schaffnit

Context: I have to print personal information on a preprinted form I've
never seen using a printer I've never seen. I want to use a control to
overlay the PrintPreview to indicate where I've printed. I want to use a
separate control in order to allow the user to drag the field to a different
position on the form so it doesn't have to come back for me to change the
code. I want to use the PrintPreview because it fits so naturally with
printing to the real printer. Note that one consequence of this strategy is
that I'll need to relocate the highlight as the PrintPreview is zoomed or
panned. Pretend that I'm using a label control with a transparent
background.

I can't find the position of the image within the PrintPreviewControl or the
PrintPreviewDialog. I've tried deriving classes from each. In the debugger
I can see several fields which are not referenced in the documentation and
which, not surprisingly, are not available to my code. One of them appears
to include the image size and location.

1. (How) can I get to the image location.

2. A control on top of the PrintPreviewControl shows the printed document
image through the label. A control on top of the PrintPreviewDialog (form)
shows the dialog's background through the label. Should I assume that the
Dialog approach is a dead end?

3. What else am I not seeing?

Thanks,
Ramsey
 
Hi Ramsey,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to get the position of image
that is displayed on the PrintPreview control. If there is any
misunderstanding, please feel free to let me know.

I didn't find the property to get the position of the image yet. If you can
see some member that indicates the position of the print document image,
that must be a private member. Thus, we can use Reflection classes to get
the value of them. However, since this is not documented, it is not
recommended to do so. When the preview document is zoomed or scrolled, the
label will not move to new position accordingly.

Please check the following link for more information about reflection.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemreflection.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Yep. That's the idea. And, sure, the control won't reposition itself, but
if I can position it originally, I can do it again.

Plan B is to add a highlight at the time I print the preview, but then
moving the highlight cannot be done by dragging, but must be done in another
window.

The dragging part is working. I just have no idea where I'm dragging from
or to!
 
Hi Ramsey,

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top