Zoom in CADImage in C#
Moderators: SDS, support, admin
Zoom in CADImage in C#
im making an aplication with the CADimage.dll (eval version, for now) and i want to use a zoom y some particular area (under the mouse) but i dont know what to do, because using fscale the draw goes to the upper left corner.
can anyone help me, do someone understand me, im from argenina and i dont speak inglish wel
walter
can anyone help me, do someone understand me, im from argenina and i dont speak inglish wel

walter
Hello Walter,
We have added zooming by mouse wheel like in AutoCAD to the C# demo application. Updated package of <b>CADImage.DLL</b> is available on: http://www.cadsofttools.com/download/cadimage.zip
The folowing code was added to the modul <b>Form1.cs</b>:
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
We have added zooming by mouse wheel like in AutoCAD to the C# demo application. Updated package of <b>CADImage.DLL</b> is available on: http://www.cadsofttools.com/download/cadimage.zip
The folowing code was added to the modul <b>Form1.cs</b>:
Code: Select all
<font color="blue">public</font id="blue"> fmCADImage()
{
<font color="green">//
// Required for Windows Form Designer support
//</font id="green">
InitializeComponent();
<font color="green"> //the following line is new</font id="green">
<font color="blue">this</font id="blue">.MouseWheel += <font color="blue">new</font id="blue"> MouseEventHandler(MouseZoom);
<font color="green">//
// TODO: Add any constructor code after InitializeComponent call
//</font id="green">
}
<font color="blue">private void</font id="blue"> menuItem14_Click(<font color="blue">object</font id="blue"> sender, System.EventArgs e)
{
<font color="blue">for</font id="blue">(<font color="blue">int</font id="blue"> i = 0; i < MainMenu1.MenuItems[1].MenuItems.Count; i++)
MainMenu1.MenuItems[1].MenuItems[i].Checked = <font color="blue">false</font id="blue">;
(sender <font color="blue">as</font id="blue"> MenuItem).Checked = ! (sender <font color="blue">as</font id="blue"> MenuItem).Checked;
fScale = Convert.ToInt32((sender <font color="blue">as</font id="blue"> MenuItem).Text);
<font color="green">//the following two lines are new</font id="green">
DLLWin32Import.FX = 0;
DLLWin32Import.FY = 0;
panel1.Invalidate();
}
<font color="green">//the following method is new</font id="green">
<font color="blue">private void</font id="blue"> MouseZoom(<font color="blue">object</font id="blue"> sender, System.Windows.Forms.MouseEventArgs e)
{
<font color="blue">float</font id="blue"> prev_scale = fScale;
prev_scale = fScale;
fScale += e.Delta/12;
<font color="blue">float</font id="blue"> fs = fScale / prev_scale;
DLLWin32Import.FX = (<font color="blue">int</font id="blue">)((DLLWin32Import.FX - e.X) * Math.Abs(fs) + e.X);
DLLWin32Import.FY = (<font color="blue">int</font id="blue">)((DLLWin32Import.FY - e.Y) * Math.Abs(fs) + e.Y);
panel1.Invalidate();
}
Please post questions to the forum or write to support@cadsofttools.com
hello and thanks for your answer.
Now im trying to selec, parts from the drawing, and to know which part i select to show some info in a ... textbox.
is there a way to "select" or to know in which figure im clicking?
thanks again
--------------------------
gracias por su respuesta-
ahora estoy tratando de "seleccionar", partes del dibujo, y tratando de saber q parte he seleccionado para mostrar algun comentario en un textbox.
hay alguna forma de seleccionar o saber donde estoy clickeando?
gracias nuevamente
Now im trying to selec, parts from the drawing, and to know which part i select to show some info in a ... textbox.
is there a way to "select" or to know in which figure im clicking?
thanks again
--------------------------
gracias por su respuesta-
ahora estoy tratando de "seleccionar", partes del dibujo, y tratando de saber q parte he seleccionado para mostrar algun comentario en un textbox.
hay alguna forma de seleccionar o saber donde estoy clickeando?
gracias nuevamente