Profile Picture

Persisting the viewport

Posted By Andrew Shand 10 Years Ago
Author
Message
Andrew Shand
Posted 10 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 7, Visits: 4
I'd like to persist my NDrawingView origin and zoom values, i.e. the Viewport, so that I can later recreate the window with the same view on my document. Unfortunately, it seems that the NDrawingview.Viewport property doesn't have a setter.

How can I persist and reload the window view extent (I don't want to serialize the whole NDrawingView) ?

Thanks
Andy

Nevron Support
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi,

One of the possible solutions is to create a serializable custom class to store the viewport origin and the zoom factor and assign an instance of this class to the Tag property of the drawing document before serialization. After deserialization you can use this information to restore the zoom factor and the viewport origin.



Best Regards,
Nevron Support Team



Andrew Shand
Posted 10 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 7, Visits: 4
Thanks,

I've tried saving the NDrawingView.ViewportOrigin and NDrawingView.ScaleX & ScaleY properties, and then reassigning them back to the view when it is recreated.

On recreation, I set the ScaleX & ScaleY properties successfully, but the ViewportOrigin setter doesn't seem to "take" the PointF value I assign to it - it's getter value doesn't match the value I've set. Is there some additional validation logic within the ViewportOrigin setter that requires other stuff to be set correctly first?

Can you advise on the minimum properties I need to persist and restore to get back the zoom and pan state for the control? Are there other refresh methods I need to call?

Thanks
Andy



Similar Topics


Reading This Topic