We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get the x and y coordinates with respect to PdfViewerControl in MouseUp event?

You can get the coordinates of mouse pointer with respect to PdfViewerControl by using Mouse_Up event of the PdfViewerControl. Refer to the following code snippet.



// Add some labels in XAML page to display the values.

        <Grid>

        <syncfusion:PdfViewerControl x:Name="PdfViewer" />

        <Label x:Name="label" Content="X : " Margin="950,5,0,0"/>

        <Label x:Name="label1" Content="Y : " Margin="1100,5,0,0"/>

        <Label x:Name="label2" Margin="1000,5,0,0"/>

        <Label x:Name="label3" Margin="1150,5,0,0"/>

    </Grid> 

//Wire up the MouseUp event

PdfViewer.MouseUp += PdfViewer_MouseUp;
  private void PdfViewer_MouseUp(object sender, MouseButtonEventArgs e) 

{ 

//Get the x and y coordinates

            System.Drawing.Point position = new System.Drawing.Point

            {

                X = (int)e.GetPosition(PdfViewer).X,

                Y = (int)e.GetPosition(PdfViewer).Y

            };

            //Displays the x and y coordinates

            label2.Content = position.X;

            label3.Content = position.Y;

} 


Sample link:
http://www.syncfusion.com/downloads/support/directtrac/general/ze/FINDCO~11015392788

 

 

Article ID: Published Date: Last Revised Date: Platform: Control:
9116 08/07/2018 08/07/2018 WPF PdfViewer
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon