/// <summary> /// OnHandleCreated. /// </summary> protected override void OnHandleCreated(System.EventArgs e) { if (!this.DesignMode) { Kitware.VTK.vtkLogoWidget w = new Kitware.VTK.vtkLogoWidget(); this.m_Renderer = Kitware.VTK.vtkRenderer.New(); this.m_RenderWindow = Kitware.VTK.vtkRenderWindow.New(); System.IntPtr xdisplay = GetXDisplay(); bool isX11 = false; if (System.IntPtr.Zero != xdisplay) { isX11 = true; } if (isX11) { // If running an X11-based build, then we must use a // vtkGenericRenderWindowInteractor: // this.m_RenderWindowInteractor = Kitware.VTK.vtkGenericRenderWindowInteractor.New(); this.m_RenderWindow.SetDisplayId(xdisplay); } else { // Allow the native factory method to produce the natively expected subclass // of vtkRenderWindowInteractor: // this.m_RenderWindowInteractor = Kitware.VTK.vtkRenderWindowInteractor.New(); } Kitware.VTK.vtkInteractorStyleSwitch style = this.m_RenderWindowInteractor.GetInteractorStyle() as Kitware.VTK.vtkInteractorStyleSwitch; if (null != style) { style.SetCurrentStyleToTrackballCamera(); } this.m_RenderWindow.SetParentId(this.Handle); this.m_RenderWindow.AddRenderer(this.m_Renderer); if (!isX11) { this.AttachInteractor(); } w.Dispose(); } base.OnHandleCreated(e); }