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
fmotsch  
#1 Posted : Monday, March 5, 2018 5:28:49 AM(UTC)
Quote
fmotsch

Rank: Member

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

Thanks: 6 times
Hi,

I'm trying to get this function in static but it doesn't seems to be the solution:

Code:
 private void zoomRecherche(List<Point> coordSearched, int iSearch)
        {

            this.pdfViewer.Zoom = 1.5f;
            pdfViewer.ScrollToPoint(pdfToolBarPages.PdfViewer.CurrentIndex, coordSearched[iSearch]);
            //pdfViewer.CurrentIndex = pdfToolBarPages.PdfViewer.CurrentIndex;
			//pdfViewer.ScrollToPage(pdfToolBarPages.PdfViewer.CurrentIndex);
			//pdfViewer.ScrollToChar(coordSearched[1]);
            
                  
        }



But when i put public void zoomRecherche(List<Point> coordSearched, int iSearch), and delete the first this
i get errors messages with pdfViewer and pdfToolBarPages (which depend on pdfViewer).
How can i do to use this function on an other form?

Thanx.

Edited by user Monday, March 5, 2018 5:58:41 AM(UTC)  | Reason: Not specified

Paul Rayman  
#2 Posted : Monday, March 5, 2018 8:57:57 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)
Hi,

You should provide an instance of your pdfViewer to static method (as well as all other non-static objects).

Code:

public static void zoomRecherche(List<Point> coordSearched, int iSearch, PdfViewer myViewer)
{
    myViewer.Zoom = 1.5f;
    myViewer.ScrollToPoint(myViewer.CurrentIndex, coordSearched[iSearch]);
}


Now you can call your method

Code:

YourClass.zoomRecherche(coordSearched, iSearch, this.pdfViewer);

Edited by user Monday, March 5, 2018 8:59:30 PM(UTC)  | Reason: Not specified

thanks 1 user thanked Paul Rayman for this useful post.
fmotsch on 3/6/2018(UTC)
fmotsch  
#3 Posted : Tuesday, March 6, 2018 2:23:14 AM(UTC)
Quote
fmotsch

Rank: Member

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

Thanks: 6 times
Perfect thanks !!!! :)
Quick Reply Show Quick Reply
Users browsing this topic
Guest
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.