Synchronized views

To synchronize the camera movements between two ViewportLayouts (or two Viewports of the same ViewportLayout), you need to override the OnMouseWheel and OnMouseMove methods of the first viewportLayout and assigned the Cloned camera to the second ViewportLayout (or Viewport):

 

     public Form1()
     {
         InitializeComponent();

         // viewportLayout1.Unlock(""); // For more details see 'Product Activation' topic in the documentation.
         // viewportLayout2.Unlock("");

         ((MyVP) viewportLayout1).vp2 = viewportLayout2;
     }

     InitializeComponent()
     {
        ...
        this.viewportLayout1 = new MyVP();
        ...
     }


    class MyVP : ViewportLayout
    {
        public ViewportLayout vp2;

        protected override void OnMouseWheel(MouseEventArgs e)
        {
            base.OnMouseWheel(e);

            vp2.Camera = (Camera)Camera.Clone();
            vp2.Invalidate();
        }

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (ActionMode == actionType.Pan || ActionMode == actionType.Zoom ||
                ActionMode == actionType.Rotate)
            {
                vp2.Camera = (Camera) Camera.Clone();
                vp2.Invalidate();
            }
        }
    }

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.