[02/03] Heavy GDI+ Question Regarding PRintPreview Control
Dear all,
i have a form that contains a printpreview control that shows a print document on screen.
now i want to make the user able of modifing some positions of objects on screen. (That is ok).
he can select an object from the list of objects drawn on the document to reposition by mouse. i managed to create the code for dynamically showing and modifing the objects positions.
my problem is that i can't translate mouse click positions over the preview control into a document relative position. (Due to difference of zoom factors).
for example at zoom of 50% when the user click on the middle of the preview control, the selected position is differnce when he clicks the same mouse position but at zoom factor of 100%.
I want to translate mouse click position clicked over the preview control on the form into an inside posint coordination related to the print document.
my problem now is that my user selects a drop point and clicks over it with mouse, the object is not dropped correctly in the document due to zoom factors variations.
i hope anyone can understand me in the first place.
THank you in advance
Waiting your kind Replies
bst rgds
Re: [02/03] Heave GDI+ Question Regarding PRintPreview Control
any body ?????
is it so hard ??? :D
Re: [02/03] Heave GDI+ Question Regarding PRintPreview Control
Re: [02/03] Heavy GDI+ Question Regarding PRintPreview Control
Maged, I am not sure if I will be able to help you or not, but it does sound like you would need to do a calculation on mouse position, taking into account the current zoom level... have you tried anything like this?
Re: [02/03] Heavy GDI+ Question Regarding PRintPreview Control
Dear kleinma,
thank you for answering me. i haven't tried to do calculation because i am not sure about the graphics units conversions used in .net
if you know any good links or articles that i can read i will be very glad to help.
by the way i don't think the calculation is based on a linear equation because i have noticed the following :
when i click on a point near the top left it has a smaller error offset than clicking on a bottom right point on the same document. !!!
Re: [02/03] Heavy GDI+ Question Regarding PRintPreview Control
IIRC the print page is drawn using a pixel size in tenths of a millimeter thus an A4 page is 2970 pixels long...?
You need to take into account the zoom level, and also the offset of the start of the page relative to the print preview control - all in all a painful exercise...
Maybe you could implement your own control (based on a picture box) to do the print preview?