Menu
Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Javascript
How do I manipulate the scroll bars so that a div with content thatchanges size shows the content at
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Shauniwthanau, post: 5000424"] Here is the code written in WPF: //Gets the center of the viewport Point newPt = new Point( scrollViewer1.ViewportWidth / 2, scrollViewer1.ViewportHeight / 2); //This makes it into a point relative to the print centerPoint = scrollViewer1.TranslatePoint(newPt, PrimaryCanvas); //This divides by the scale of the smart print, so that the point is absolute in reference to the full size smartprint centerPoint.X = (this.DataContext as Work.ViewModel.AddViewModel).TranslateCoordFrom((int)centerPoint.X); centerPoint.Y = (this.DataContext as Work.ViewModel.AddViewModel).TranslateCoordFrom((int)centerPoint.Y); //Recenters view after zooming //This multiplies the points by the new scale, and subtracts half the width of the scrollviewer so that when calling ScrollTo the point is centered. int locx = (this.DataContext as Work.ViewModel.AddViewModel).TranslateCoordTo((int)centerPoint.X); locx -= (int)(scrollViewer1.ActualWidth / 2); int locy = (this.DataContext as Work.ViewModel.AddViewModel).TranslateCoordTo((int)centerPoint.Y); locy -= (int)(scrollViewer1.ActualHeight / 2); scrollViewer1.ScrollToHorizontalOffset(locx); scrollViewer1.ScrollToVerticalOffset(locy); [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Javascript
How do I manipulate the scroll bars so that a div with content thatchanges size shows the content at
Top