In CADImageDLL, which function have the zoom in an

Discuss and ask questions about CAD DLL (CAD Image DLL, CAD Importer DLL).

Moderators: SDS, support, admin

Post Reply
Jakein2006
Posts: 4
Joined: 12 Oct 2006, 09:41
Location: China

In CADImageDLL, which function have the zoom in an

Post by Jakein2006 » 17 Oct 2006, 05:59

In CADImageDLL, which function have the zoom in and zoom out functionality? Can you show me or give me some samples for it?

I appreciate your help.

jake

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 17 Oct 2006, 14:59

Hello Jake,

<b>CAD Image DLL</b> has the following function:

Code: Select all

int DrawCADEx(
  <font color="blue">HANDLE</font id="blue"> <b>hObject</b>,
  <font color="blue">LPCADDRAW</font id="blue"> <b>lpcd</b>
);
<i>hObject</i>
<br />Identifies a <b>CADImage</b> object handle.
<br /><i>lpcd</i>
<br />Points to <font color="blue">CADDRAW</font id="blue"> structure containing the device context, logical coordinates, drawing format etc.
<br />The <b>DrawCADEx</b> function draws <b>CADImage</b> object on specified device context.
<br />This function allows defining necessary scale factor. Usually it is called on WM_PAINT event.
<br />The following example you can find in the <b>VC</b> demo application available in the <b>CAD Image DLL</b> package (http://www.cadsofttools.com/download/cadimage.zip) in the ..\cadimage\DemoVC\.. folder.

Code: Select all

<font color="blue">void</font id="blue"> CMainWindow::Draw()
{
   <font color="blue">if</font id="blue"> (bIsPocessing) 
	<font color="blue">return</font id="blue">;
	
   PAINTSTRUCT Paint;
   HDC hDC;		

   hDC = BeginPaint(hWnd, &Paint);	
   OldNearestPoint.x = -10;
   OldNearestPoint.y = -10;
   SetBgrndColor(colorBgrnd);

   <font color="blue">if</font id="blue"> ((CADImage) 
<font color="blue">#ifndef</font id="blue"> CS_STATIC_DLL
   	&& 
   	(DrawCADEx)
<font color="blue">#endif</font id="blue">
   	)
	{		
        <font color="blue">if</font id="blue"> (fAbsHeight > 0)
	  {		
	     sgFloat scale = (sgFloat) nScale / 100.0;
	     memset(&CADDraw, 0, <font color="blue">sizeof</font id="blue">(CADDRAW));
	     GetClientRect(hWnd, &CADDraw.R);
	     CADDraw.R.left = <font color="blue">int</font id="blue">(CADDraw.R.left  * scale) + offset.x;
	     CADDraw.R.right = <font color="blue">int</font id="blue">(CADDraw.R.right * scale) + offset.x;
	     CADDraw.R.top = <font color="blue">int</font id="blue">(CADDraw.R.top * scale) + offset.y;	
	     CADDraw.R.bottom = <font color="blue">int</font id="blue">(CADDraw.R.top  + (CADDraw.R.right - CADDraw.R.left) * fKoef);						
	     ScaleRect.x = fAbsWidth / (CADDraw.R.right - CADDraw.R.left);
	     ScaleRect.y = fAbsHeight / (CADDraw.R.bottom - CADDraw.R.top);
	     CADDraw.Size = <font color="blue">sizeof</font id="blue">(CADDRAW);			
	     CADDraw.DrawMode = DrwMode;
	     CADDraw.DC = hDC;
			
	     DrawCADEx(CADImage, &CADDraw);			
	     }		
	}
   EndPaint(hWnd, &Paint);	
}
Sergey.

please post questions to the forum or write to support@cadsofttools.com

Post Reply