Exemplo n.º 1
0
 private void Form1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         using (Teigha.GraphicsSystem.View pView = helperDevice.ActiveView)
         {
             ClearSelection();
             selRect = new RectFram(toEyeToWorld(e.X, e.Y));
             pView.Add(selRect);
             startSelPoint = new Point2d(e.X, e.Y);
             Invalidate();
             selRect.setValue(toEyeToWorld(e.X + _SelectRegion, e.Y + _SelectRegion));
             pView.Select(
                 new Point2dCollection(new Point2d[] { startSelPoint, new Point2d(e.X + _SelectRegion, e.Y + _SelectRegion) }),
                 new SR(selected, database.CurrentSpaceId),
                 startSelPoint.X < e.X
       ? Teigha.GraphicsSystem.SelectionMode.Window
       : Teigha.GraphicsSystem.SelectionMode.Crossing);
             pView.Erase(selRect);
             selRect = null;
             gripManager.updateSelection(selected);
             helperDevice.Invalidate();
             Invalidate();
         }
     }
     else if (e.Button == MouseButtons.Right)
     {
         _IsMoving     = true;
         startSelPoint = new Point2d(e.X, e.Y);
     }
 }
Exemplo n.º 2
0
 private void DisposeCadComponent()
 {
     try
     {
         ClearSelection();
         CadSelectionManager.Instance.Dispose();
         if (selRect != null)
         {
             helperDevice.ActiveView.Erase(selRect);
         }
         selRect = null;
         if (gripManager != null)
         {
             gripManager.uninit();
             gripManager = null;
         }
         if (graphics != null)
         {
             graphics.Dispose();
         }
         if (helperDevice != null)
         {
             if (!helperDevice.IsDisposed)
             {
                 helperDevice.Dispose();
                 helperDevice = null;
             }
         }
         if (database != null)
         {
             if (!database.IsDisposed)
             {
                 database.Dispose();
                 database = null;
             }
         }
         if (dd != null)
         {
             dd.Dispose();
             dd = null;
         }
     }
     catch (System.Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
Exemplo n.º 3
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Escape:
                switch (mouseMode)
                {
                case Mode.DragDrop:
                {
                    using (Teigha.GraphicsSystem.View pView = helperDevice.ActiveView)
                    {
                        gripManager.DragFinal(new Point3d(), false);
                        helperDevice.Model.Invalidate(InvalidationHint.kInvalidateAll);
                        Invalidate();
                    }
                    break;
                }

                case Mode.Selection:
                    if (selRect != null)
                    {
                        using (Teigha.GraphicsSystem.View pView = helperDevice.ActiveView)
                        {
                            pView.Erase(selRect);
                            selRect = null;
                        }
                    }
                    break;
                }
                mouseMode = Mode.Quiescent;

                ClearSelection();
                break;

            case Keys.Oemplus:
                break;

            case Keys.OemMinus:
                break;
            }
        }