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 : Monday, June 9, 2008 5:34:25 AM(UTC)

nick  
nick

Groups: Registered
Posts: 8


i have an image at 100%
When i have a floaterimage and i click on the zoom button, i want to zoom as big as the floateriamge.
So the selection of the floaterimage is as big as the rasterview.
How can i do that?

the code below just zooms in app. 20% at the time, when clicking on the zoom button and there isnt a floaterimage.

RasterImageViewer viewer = scanViewer;
Rectangle rc = Rectangle.Intersect(viewer.PhysicalViewRectangle, viewer.ClientRectangle);
PointF center = new PointF(rc.Left + rc.Width / 2, rc.Top + rc.Height / 2);
viewer.RegionToFloater();
if (viewer.FloaterImage != null)
{
//RemoveFloater();

}

Transformer t = new Transformer(viewer.Transform);
center = t.PointToLogical(center);


double scaleFactor = viewer.ScaleFactor;
const float ratio = 1.2F;
scaleFactor *= ratio;
if ((100 * scaleFactor) < sZoom.Maximum)
sZoom.Value = (int)(100 * scaleFactor);
else
{
sZoom.Value = 400;
scaleFactor = 4;
}

scaleFactor = Math.Max(_MinimumScaleFactor, Math.Min(_MaximumScaleFactor, scaleFactor));

if (viewer.ScaleFactor != scaleFactor)
{
viewer.ScaleFactor = scaleFactor;
t = new Transformer(viewer.Transform);
center = t.PointToPhysical(center);
viewer.CenterAtPoint(Point.Round(center));
}
viewer.CenterAtPoint(viewer.FloaterPosition);



 

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 : Tuesday, June 10, 2008 6:11:58 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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


I'm not
sure if this is what you want, but you might solve the problem by checking the GetRegionBounds
and then call the RasterImageViewer.ZoomToRect function. You might have to
convert from bitmap coordinates to client coordinates using PointFromImage method.


 


If this is
not what you need, please explain what you need in more details and create a small sample project that shows the problem and put it in a ZIP or RAR file.


If you are attaching here, do not use the Preview feature.

 
#3 Posted : Friday, June 13, 2008 1:30:12 AM(UTC)

nick  
nick

Groups: Registered
Posts: 8


thanks it works

this is my code


private void cbiZoomIn_Click(object sender, EventArgs e)
{
if (HasPicture)
{
RasterImageViewer viewer = scanViewer;
Transformer t = new Transformer(viewer.Transform);
Rectangle rc = Rectangle.Intersect(viewer.PhysicalViewRectangle, viewer.ClientRectangle);
PointF center = new PointF(rc.Left + rc.Width / 2, rc.Top + rc.Height / 2);
viewer.RegionToFloater();
if (viewer.FloaterImage != null)
{
//zoom to floater image
viewer.ZoomToRectangle(viewer.FloaterImage.GetRegionBounds(null));
center = new PointF(viewer.FloaterPosition.X + viewer.FloaterImage.Width / 2, viewer.FloaterPosition.Y + viewer.FloaterImage.Height / 2);
center = t.PointToPhysical(center);
viewer.CenterAtPoint(Point.Round(center));
RemoveFloater();
}
else
{
//zoom normal
center = t.PointToLogical(center);
viewer.CenterAtPoint(viewer.FloaterPosition);
}

double scaleFactor = viewer.ScaleFactor;
const float ratio = 1.2F;
scaleFactor *= ratio;
if ((100 * scaleFactor) < sZoom.Maximum)
sZoom.Value = (int)(100 * scaleFactor);
else
{
sZoom.Value = 400;
scaleFactor = 4;
}

scaleFactor = Math.Max(_MinimumScaleFactor, Math.Min(_MaximumScaleFactor, scaleFactor));

if (viewer.ScaleFactor != scaleFactor)
{
viewer.ScaleFactor = scaleFactor;
t = new Transformer(viewer.Transform);
center = t.PointToPhysical(center);
viewer.CenterAtPoint(Point.Round(center));
}
}
}
 
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.108 seconds.