This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, June 9, 2008 5:34:25 AM(UTC)
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);
#2
Posted
:
Tuesday, June 10, 2008 6:11:58 AM(UTC)
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)
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.