Mousemove event and moving entity

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
Khyati
Posts: 34
Joined: 08 Feb 2011, 08:55

Mousemove event and moving entity

Post by Khyati » 20 Apr 2011, 12:27

Hello,

i wrote following code for mousemove event:

Code: Select all

method MainForm.CadEditorCtrl_PictureBox_MouseMove(sender: System.Object; e: System.Windows.Forms.MouseEventArgs);
var
    Pos_CAD : CADImport.DPoint;
begin
      Pos_CAD := new CADImport.DPoint(e.X, e.Y, 0);
      Pos_CAD := cadEditorControl1.GetRealPoint(e.X, e.Y);
      entPt.Point := Pos_CAD;
    
      entPt.Loaded(cadEditorControl1.Image.Converter);
      cadEditorControl1.Invalidate();
end;
But my point is not moving with mouse move.. instead it moves, only after i do mouse click.
even if i change window, then also it moves the mouse as per i moved mouse.

What's missing in above code?

Khyati
Posts: 34
Joined: 08 Feb 2011, 08:55

Re: Mousemove event and moving entity

Post by Khyati » 21 Apr 2011, 11:16

I hope you've some solution for above post!
As we are in very critical stage for our project design, i need your help!

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

Re: Mousemove event and moving entity

Post by support » 22 Apr 2011, 14:35

Hello Khyati.
Moving entity with mouse relates to visual functionality. Method that you use to change entity location not correct for such task. Demo applications provides moving selected entities when mouse left button is down. The functionality is common for CAD editing and implemented in CADEditorControl component. We're not sure why need another solution or that is the purpose of created method. Selected entities can be moved on MouseMove without mouse button down like this:

Code: Select all

public class MainForm : System.Windows.Forms.Form
{	
    private int cX, cY; 
    ....
    
    private void cadEditorControl_MouseMove(object sender, MouseEventArgs e)
    {
        if (cadEditorControl.Image == null)
            return;
        if (cadEditorControl.Image.SelectEntitiesCount > 0)
        {
            cadEditorControl.ChangeEntityOnMouseMove(new Point(e.X, e.Y));
            PointF imp = cadEditorControl.ImagePosition;
            PointF cr = new PointF(imp.X - (cX - e.X), imp.Y - (cY - e.Y));
            cadEditorControl.ImagePosition = cr;
            cadEditorControl.Invalidate();
            cX = e.X;
            cY = e.Y;
        }
    }	
If you're not like select entities by mouse then you can do it programmatically.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply