This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
Brett  
#1 Posted : Wednesday, July 13, 2005 3:40:00 PM(UTC)
Brett

Rank: Member

Groups: Guest
Joined: 7/13/2005(UTC)
Posts: 2

Hi,

I am wondering if it is possible to zoom to a given rectangle? In my application I want to be able to pass in a rectangle object or set of coordinates, and then zoom to that rectangle on my bitmap. I also want to save the current postion(this may change due to rezooming or panning/scrolling) that is visable so I can reopen the same file later looking at the same position.

I have tried a number of things so far, including using a RectangleRubberband to provide my area that I want to zoom to. Unfortunately I have only been able to crop the original image using this rectangle (I can't find out how to zoom to a given rectangle).

I have also used the ZoomRectangleNavigator. Although this allows me to change my current zoomed area, it can't figure out a way to use it to zoom to a predetermined area.

Sorry if this is simple, I am new to C#.

Cheers,

Brett.
Andrew  
#2 Posted : Thursday, July 14, 2005 12:25:00 AM(UTC)
Andrew

Rank: Advanced Member

Groups: Guest
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
ZoomRectangleNavigator should be ok to you. When you drag the rectangle, the control zooms to fit the selected rectangle to the entire screen.

Or you want to zoom to specified rectangle size programmatically?

P.S. By the way, are you talking about WinControls or WebControls version?
Brett  
#3 Posted : Thursday, July 14, 2005 9:57:00 AM(UTC)
Brett

Rank: Member

Groups: Guest
Joined: 7/13/2005(UTC)
Posts: 2

Although ZoomRectangleNavigator does what I require as far as the navigation and zooming in one goes, I also want to save the position of the bitmap inside the control so I can load it next time I load the picture.

Or you want to zoom to specified rectangle size programmatically?

Yeah, this is what I am after. I want to zoom/pan programmatically to a spcified rectangle when I load the picture. I also want to save the area where I was last zoomed to (so it can be loaded next time).

Another way I though of doing this was I could specifiy a reference point (say the top left corner of the control) and get the pixel reference on the bitmap (don't know how to do this either!). Using this reference pixel and the zoom, I could reconstruct what the user was last viewing (if I could figure out how to save/load a picture to a reference pixel).

I am using WinControls.

Cheers,
Andrew  
#4 Posted : Thursday, July 14, 2005 9:51:00 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Guest
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
In this case you need not navigator control at all. You can get/set a position of the scroll bars (see ScrollingPosition property of the BitmapViewer) and zoom factor (Zoom property).

Hope this helps.
Users browsing this topic
Guest (2)
Forum Jump  
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.