LEADTOOLS Support
General
LEADTOOLS SDK Examples
Not able to retain position in raster after changing scale
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, May 31, 2012 5:40:11 AM(UTC)
Groups: Registered
Posts: 8
We were using zoom in and out functionality in LeadTools.Winforms.RasterImageViewer, we were finding its center by using RasterImageViewer's properties PhysicalViewRectangle and ClientRectangle, changing the scale of the RasterImageViewer and calling CenterAtPoint method to retain the position of image in raster.
We are trying to achieve same functionality with Leadtools.Windows.Controls.RasterImageViewer but the properties PhysicalViewRectangle and ClientRectangle do not exist in Leadtools.Windows.Controls.RasterImageViewer. So when I set the scale of raster viewer it zooms but the position of Image in raster is not maintained.
Please suggest any other way to maintain the position of image in raster.
#2
Posted
:
Friday, June 1, 2012 6:42:08 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Hello,
Please see the Silverlight example code for the CenterAtPoint method. It shows how to change the scalefactor of the ImageViewer and re-position the image so that it's centered after changing that property:
http://www.leadtools.com/help/leadtools/v175/dh/wl/leadtools.windows.controls~leadtools.windows.controls.imageviewer~centeratpoint.html
If you are looking to do something different, please let me know.
Thanks,
#3
Posted
:
Wednesday, June 6, 2012 11:37:55 PM(UTC)
Groups: Registered
Posts: 8
JamesD wrote:Hello,
Please see the Silverlight example code for the CenterAtPoint method. It shows how to change the scalefactor of the ImageViewer and re-position the image so that it's centered after changing that property:
http://www.leadtools.com...iewer~centeratpoint.html
If you are looking to do something different, please let me know.
Thanks,
Hi James,
What I want to achieve is, I have a long image. I want to keep the the center same after zoom as it was before (I want to keep the position of image in raster same as it was before zoom). I tried the sample mentioned in the link posted by you, but it does not work for me. When I zoom in, multiple times, the position of Image is lost and focus goes to bottom as I zoom in.
I have attached the sample project and the test image, please suggest how to solve this issue.
#4
Posted
:
Friday, June 8, 2012 6:37:39 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Hello,
I've modified the "ZoomAndCenter" method in your sample project. The modified method manually adjusts the ImageViewer's ScrollViewer Offset properties to position the image centered (meaning it doesn't move position) in the ImageViewer when the ScaleFactor is increased or decreased. I believe it demonstrates the functionality you've requested. Let me know if you have any questions.
Thanks,
#5
Posted
:
Monday, June 11, 2012 11:27:11 PM(UTC)
Groups: Registered
Posts: 8
Quote:JamesD wrote:Hello,
I've modified the "ZoomAndCenter" method in your sample project. The modified method manually adjusts the ImageViewer's ScrollViewer Offset properties to position the image centered (meaning it doesn't move position) in the ImageViewer when the ScaleFactor is increased or decreased. I believe it demonstrates the functionality you've requested. Let me know if you have any questions.
Thanks,
That worked like charm. Thank you James!!
Edited by moderator Wednesday, October 19, 2016 8:41:28 AM(UTC)
| Reason: Not specified
#6
Posted
:
Wednesday, June 20, 2012 6:03:10 AM(UTC)
Groups: Registered
Posts: 8
<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/CS/Themes/default/images/icon-quote.gif"> <strong>JamesD wrote:</strong></td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4">Hello,
I've modified the "ZoomAndCenter" method in your sample project. The modified method manually adjusts the ImageViewer's ScrollViewer Offset properties to position the image centered (meaning it doesn't move position) in the ImageViewer when the ScaleFactor is increased or decreased. I believe it demonstrates the functionality you've requested. Let me know if you have any questions.
Thanks,</td></tr></table></td></tr></table></BLOCKQUOTE>
Hi James,
The sample is working fine, but there is one more issue, when I changed the sample by setting the scale value to some constant(between 0.25 to 4.0), instead of multiplying it with some value, and again the image position was lost in the viewer. I have attached the modified sample. Can you please look into?
#7
Posted
:
Wednesday, June 20, 2012 6:04:45 AM(UTC)
Groups: Registered
Posts: 8
<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/CS/Themes/default/images/icon-quote.gif"> <strong>JamesD wrote:</strong></td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4">Hello,
I've modified the "ZoomAndCenter" method in your sample project. The modified method manually adjusts the ImageViewer's ScrollViewer Offset properties to position the image centered (meaning it doesn't move position) in the ImageViewer when the ScaleFactor is increased or decreased. I believe it demonstrates the functionality you've requested. Let me know if you have any questions.
Thanks,</td></tr></table></td></tr></table></BLOCKQUOTE>
Hi James,
The sample is working fine, but there is one more issue, when I changed the sample by setting the scale value to some constant(between 0.25 to 4.0), instead of multiplying it with some value, and again the image position was lost in the viewer. I have attached the modified sample project. Is there any generic way to maintain image position?
#8
Posted
:
Wednesday, June 20, 2012 6:07:42 AM(UTC)
Groups: Registered
Posts: 8
Attaching modified sample project
#9
Posted
:
Wednesday, June 20, 2012 11:36:38 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
In ZoomAndCenter method, you need to change the calculations for the 'extraShiftH' and 'extraShiftV' values. Multiplying them by the newScaleFactor is what's causing the method to give you incorrect results. I have attached the updated code for that method.
Thanks,
LEADTOOLS Support
General
LEADTOOLS SDK Examples
Not able to retain position in raster after changing scale
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.