Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, May 31, 2012 5:40:11 AM(UTC)

vivekse  
vivekse

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.
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, June 1, 2012 6:42:08 AM(UTC)

JamesD  
Guest

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)

vivekse  
vivekse

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.

File Attachment(s):
LeadtoolsSample.zip (3,373kb) downloaded 98 time(s).
 
#4 Posted : Friday, June 8, 2012 6:37:39 AM(UTC)

JamesD  
Guest

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,
File Attachment(s):
Leadtools.Test - Modified Zoom and Center.zip (1,948kb) downloaded 100 time(s).
 
#5 Posted : Monday, June 11, 2012 11:27:11 PM(UTC)

vivekse  
vivekse

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)

vivekse  
vivekse

Groups: Registered
Posts: 8


<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/CS/Themes/default/images/icon-quote.gif">&nbsp;<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?
File Attachment(s):
Leadtools.Test - Modified Zoom and Center.rar (3,726kb) downloaded 100 time(s).
 
#7 Posted : Wednesday, June 20, 2012 6:04:45 AM(UTC)

vivekse  
vivekse

Groups: Registered
Posts: 8


<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/CS/Themes/default/images/icon-quote.gif">&nbsp;<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)

vivekse  
vivekse

Groups: Registered
Posts: 8


Attaching modified sample project
File Attachment(s):
Leadtools.Test - Modified Zoom and Center.rar (3,726kb) downloaded 99 time(s).
 
#9 Posted : Wednesday, June 20, 2012 11:36:38 AM(UTC)

JamesD  
Guest

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,
File Attachment(s):
Updated-ZoomAndCenter.txt (2kb) downloaded 101 time(s).
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.348 seconds.