Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: zooming within an floaterimage
Started by nick@compufit at 06-09-2008 10:39. Topic has 2 replies.

Print Search « Previous Thread Next Thread »
  06-09-2008, 10:39
nick@compufit is not online. Last active: 6/9/2008 2:25:23 PM nick@compufit

Top 500 Posts
Joined on 06-09-2008
Posts 8
zooming within an floaterimage
Reply Quote
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);




   Report 
  06-10-2008, 11:16
Adam Boulad is not online. Last active: 9/17/2008 8:07:07 AM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 423
Re: zooming within an floaterimage
Reply Quote

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.


Adam Boulad
LEADTOOLS Technical Support

   Report 
  06-13-2008, 6:35
nick@compufit is not online. Last active: 6/9/2008 2:25:23 PM nick@compufit

Top 500 Posts
Joined on 06-09-2008
Posts 8
Re: zooming within an floaterimage
Reply Quote
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));
}
}
}
   Report 
Post
LEAD Support Fo... » Developer » DotNet » Re: zooming within an floaterimage

Powered by Community Server, by Telligent Systems