This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, May 4, 2011 11:24:07 AM(UTC)
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#.
#2
Posted
:
Thursday, May 5, 2011 6:23:01 AM(UTC)
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)
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)
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.
#5
Posted
:
Friday, May 6, 2011 11:33:03 AM(UTC)
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.