Zoom in a box
Moderators: SDS, support, admin
Zoom in a box
Hi,
we want to paint an zooming-area in a separat box.
The rectangle for the zoom-area is not the problem, but the method for calculated !!! ( Our example is not exactly )
for example:
iXw - Width of the select-box
AnchorX - LeftCorner of the s.b.
curX - RightCorner of the s.b.
iXw := pbImage.clientREct.Right;
FScale := iXw / (Curx - AnchorX) * FScale ;
fx := round(FScale / 100 * (-1)*(AnchorX-fx));
fy := round(FScale / 100 * (-1)*(AnchorY-fy));
pbImage.Invalidate;
Can you help us ?
( Delphi 2007, CadImageDLL)
we want to paint an zooming-area in a separat box.
The rectangle for the zoom-area is not the problem, but the method for calculated !!! ( Our example is not exactly )
for example:
iXw - Width of the select-box
AnchorX - LeftCorner of the s.b.
curX - RightCorner of the s.b.
iXw := pbImage.clientREct.Right;
FScale := iXw / (Curx - AnchorX) * FScale ;
fx := round(FScale / 100 * (-1)*(AnchorX-fx));
fy := round(FScale / 100 * (-1)*(AnchorY-fy));
pbImage.Invalidate;
Can you help us ?
( Delphi 2007, CadImageDLL)
Hi!
The following example is based on <b>DemoDelphi</b> from the CADImage.DLL package (Web page: http://www.cadsofttools.com/en/products ... e_dll.html).
<ul><li>1. Add new form to the project.</li>
<li>2. Add the following lines:</li>
<li>3. Add OnPaint handler:</li>
<li>4. Open fMain.pas module.</li>
<li>5. Add at the end of procedure TfmMain.pbImagePaint:</li>
<li>6. Add at the beginning of procedure TfmMain.pbImageMouseMove:</li></ul>
Sergey
Please post questions to the forum or write to support@cadsofttools.com
The following example is based on <b>DemoDelphi</b> from the CADImage.DLL package (Web page: http://www.cadsofttools.com/en/products ... e_dll.html).
<ul><li>1. Add new form to the project.</li>
<li>2. Add the following lines:
Code: Select all
<b>uses</b>
... sgcadimage;
TForm2 = <b>class</b>(TForm)
...
<b>public</b>
FImgRect: TRect;
FParentRect: TRect;
FX: Integer;
FY: Integer;
...
<b>implementation
uses</b>
fMain, Types;
<li>3. Add OnPaint handler:
Code: Select all
<b>procedure</b> TForm2.FormPaint(Sender: TObject);
<b>var</b>
vRect: TRect;
vScale: Integer;
<b>begin</b>
vScale := 4;
vRect := FImgRect;
vRect.Left := (vRect.Left * vScale - (FX * vScale - Form2.Width <b>div</b> 2));
vRect.Right := (vRect.Right * vScale - (FX * vScale - Form2.Width <b>div</b> 2));
vRect.Top := (vRect.Top * vScale - (FY * vScale - Form2.Height <b>div</b> 2));
vRect.Bottom := (vRect.Bottom * vScale- (FY * vScale - Form2.Height <b>div</b> 2));
DrawCAD(CADFile, Form2.Canvas.Handle, vRect);
<b>end</b>;
<li>4. Open fMain.pas module.</li>
<li>5. Add at the end of procedure TfmMain.pbImagePaint:
Code: Select all
Form2.FImgRect := vRect;
<li>6. Add at the beginning of procedure TfmMain.pbImageMouseMove:
Code: Select all
Form2.FX := X;
Form2.FY := Y;
Form2.Invalidate;
Sergey
Please post questions to the forum or write to support@cadsofttools.com