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 : Wednesday, May 4, 2011 11:24:07 AM(UTC)

td1282  
td1282

Groups: Registered
Posts: 8


How do I rubberband two images at the same time .i.e select a region on one image and zoom to that region on another image also using c#.
 

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 : Thursday, May 5, 2011 6:23:01 AM(UTC)

Ryan  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)



You can accomplish this by setting the RasterImageViewers InteractiveMode to Region. Then once the RasterImageViewer's InteractiveMode event has been called, pass the Region of the ImageViewer that's throwing the event to the other ImageViewer.


You could call ZoomToRectangle and pass the Region's bounding rectangle if you'd like to zoom.

It'd be something like this:

//Get the selected Region's bounding rect from the opposing Viewer
LeadRect lRect = rasterImageViewer1.Image.GetRegionBounds(null);
Rectangle rect = new Rectangle(lRect.X, lRect.Y, lRect.Width, lRect.Height);

//Zoom to the region

rasterImageViewer2.ZoomToRectangle(rect);
 
#3 Posted : Thursday, May 5, 2011 10:38:16 AM(UTC)

td1282  
td1282

Groups: Registered
Posts: 8


I tried that but when the ineractive mode starts, the 2nd image disappears. Her's my code:

private void btnZoomTo_Click(object sender, EventArgs e)
{
Viewer1.InteractiveMode = RasterViewerInteractiveMode.ZoomTo;
Viewer2.InteractiveMode = RasterViewerInteractiveMode.ZoomTo;
Viewer1.InteractiveZoomTo += new RasterViewerRectangleEventHandler(Viewer_InteractiveZoomTo);
}

void Viewer_InteractiveZoomTo(object sender, RasterViewerRectangleEventArgs e)
{
Rectangle lRect = _sourceImagePane.leadImageViewer.Viewer.Image.GetRegionBounds(null);
Rectangle rect = new Rectangle(lRect.X, lRect.Y, lRect.Width, lRect.Height);

Viewer2.ZoomToRectangle(rect);
}

I'm using version 14.5, so I am using Rectangle instead of LeadRect. What am I doing wrong?
 
#4 Posted : Friday, May 6, 2011 4:17:50 AM(UTC)

Ryan  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)



Normal
0




false
false
false

EN-US
X-NONE
X-NONE













MicrosoftInternetExplorer4



























































































































































/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}


ZoomTo does not set the region. It just performs
ZoomToRectangle on the drawn rectangle. Try using Region as the interactive mode.

Another thing to note is the InteractiveZoomTo event is triggered as soon as ZoomTo begins, so the rect hasn’t necessarily been drawn yet. You should use the InteractiveModeEnded event so you can be sure the interactive mode has completed.


I've attached a very simple project that demonstrates what I believe your trying to accomplish.


 


File Attachment(s):
RegionSample v14.5.zip (11kb) downloaded 32 time(s).
 
#5 Posted : Friday, May 6, 2011 11:33:03 AM(UTC)

td1282  
td1282

Groups: Registered
Posts: 8


That's exactly what I needed. Thanks for your help!
 
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.113 seconds.