logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
Guest  
#1 Posted : Wednesday, November 15, 2017 2:20:37 AM(UTC)
Quote
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 162

Was thanked: 5 time(s) in 5 post(s)
Hello everyone,

With your help, and more specifically, Paul Rayman's help (thanks again), I have been able to put a nice mouse wheel zoom on my application.
I'm now facing a new zoom problem.
When I zoom out on my PDF, there is no problem, but when i zoom in, the zoom isn't very precise at the beginning because the PDF page is vertically centered when the vertical scrollbar is visible.

I would like that the PDF stay focus on where the mouse cursor is (vertically). I would like to end up with a floating margin top and bottom.

Can someone tell me where (or how) the PDF position is managed.

Thank you very much !

Edited by user Sunday, November 19, 2017 10:47:56 PM(UTC)  | Reason: Not specified

Paul Rayman  
#2 Posted : Thursday, November 16, 2017 1:09:55 AM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
The pages in the viewer are aligned according to the PageAlign property.
In your case, you have PageAlign = MiddleCenter.

There is only one way to influence to page position. If you know the displayed size of the page and the client size of the viewer, then you can calculate the page offset from its normal position. Accordingly, you can set the padding value of the viewer and thus move the page to the desired position vertically.
Summarizing:
1. set pdfViewer.PageAlign to ContentAlignment.TopCenter
2. Calculate page offset from the top border of the viewer
3. set pdfViewer.Padding.Top to calculated value.
fmotsch  
#3 Posted : Tuesday, February 6, 2018 7:02:54 AM(UTC)
Quote
fmotsch

Rank: Member

Groups: Registered
Joined: 2/6/2018(UTC)
Posts: 11
France
Location: Paris

Thanks: 6 times
Hello Paul,

I've tried that:

PageHAlign : Center
PageVAlign: Top
VerticalAlignement: Stretch
Vertical contentAlignement : Top

And then i tried with this code:

private void pdfViewerMouseWheel(object sender, MouseWheelEventArgs e)
{
if (e.Delta < 0 || e.Delta > 0)
{
// Get the x and y coordinates of the mouse pointer.
System.Windows.Point position = e.GetPosition(this);
double pY = position.Y;
double pX = position.X;


// Sets the Height/Width of the circle to the mouse coordinates.
pdfViewer.Height = pY;
pdfViewer.Width = pX;


}
}

The problem is that all the pdfViewer move and i would like that only the open PDF follows the mouse cursor...
Can you help me?

Thanks
Paul Rayman  
#4 Posted : Tuesday, February 6, 2018 5:24:58 PM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
If I understood you correctly, you should change pdfViewer1.Padding property

Edited by user Tuesday, February 6, 2018 5:26:04 PM(UTC)  | Reason: Not specified

thanks 1 user thanked Paul Rayman for this useful post.
fmotsch on 2/26/2018(UTC)
fmotsch  
#5 Posted : Wednesday, February 7, 2018 1:01:00 AM(UTC)
Quote
fmotsch

Rank: Member

Groups: Registered
Joined: 2/6/2018(UTC)
Posts: 11
France
Location: Paris

Thanks: 6 times
Thank you, it works perfectly !!!!!
Quick Reply Show Quick Reply
Users browsing this topic
Guest (2)
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.