How to Mirror Multiple GdViewer Instances

Discussions about document viewing.
Post Reply
SkydiverFL
Posts: 5
Joined: Fri May 18, 2012 9:24 am

How to Mirror Multiple GdViewer Instances

Post by SkydiverFL » Fri Jul 06, 2012 1:04 pm

The app I'm building needs two viewers side-by-side... one to show the sample / working image and one for the resulting image. I would like all of the pan and zoom actions in one viewer to be mirrored identically in the second viewer, and vice versa. Is there an existing mechanism to handle this? Do I need to handle each event myself? If I must manually handle each event, what are the minimum events I would need to account for?

Thanx,
Fred

SkydiverFL
Posts: 5
Joined: Fri May 18, 2012 9:24 am

Re: How to Mirror Multiple GdViewer Instances

Post by SkydiverFL » Fri Jul 06, 2012 3:32 pm

It's working fine with the following...

Code: Select all

            toViewer.ZoomMode = fromViewer.ZoomMode;
            toViewer.Zoom = fromViewer.Zoom;

            toViewer.DocumentAlignment = fromViewer.DocumentAlignment;
            toViewer.DocumentPosition = fromViewer.DocumentPosition;
            toViewer.SetVScrollBarPosition(fromViewer.GetVScrollBarPosition());
            toViewer.SetHScrollBarPosition(fromViewer.GetHScrollBarPosition());
I'm calling this on ScrollViewer, AfterZoomChange, and whenever either viewer's Document changes. There's a bit of error handling mixed in there to prevent mismatched document sizes from causing an error. And, some of this may be overkill. But, it works for my purposes at the moment.

Hope this helps.

Thanx,
Fred

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: How to Mirror Multiple GdViewer Instances

Post by SamiKharma » Fri Jul 06, 2012 3:45 pm

Hi Fred,

That's pretty much it, and if you want, you can also have a look at our Document Clean Up demo in the c# folder of the demos folder.
It has exactly what you want.

Best Regards,
Sami Kharma
GdPicture Support

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests