public ViewControl() { InitializeComponent(); //控制控件闪烁 SetStyle(ControlStyles.AllPaintingInWmPaint, true); //禁止擦除背景 SetStyle(ControlStyles.DoubleBuffer, true); //双缓冲 SetStyle(ControlStyles.UserPaint, true); //自行绘制图片 GraphicsConfig graphicsConfig = new GraphicsConfig(); graphicsConfig.BackColor = BackColor; graphicsConfig.CorrectColorForBackgroundColor = true; gdiGraphics3D = new GDIGraphics3D(graphicsConfig); gdiGraphics3D.EnableDrawablesUpdate(); graphicsCache = new WireframeGraphicsCache(false, true); graphicsCache.Config = graphicsConfig; graphicsHelper = new GraphicsHelper(System.Drawing.Color.Blue); bounds = new Bounds3D(); transformationProvider = new SimpleTransformationProvider3D(); transformationProvider.TransformsChanged += new EventHandler(transformationProvider_TransformsChanged); panInteractor = new SimplePanInteractor(transformationProvider); rectZoomInteractor = new SimpleRectZoomInteractor(transformationProvider); zoomWheelInteractor = new SimpleZoomWheelInteractor(transformationProvider); rectZoomInteractorDrawable = new SimpleRectZoomInteractor.WinFormsDrawable(rectZoomInteractor); }
public void SetTransformationProvider( SimpleTransformationProviderBase transformationProvider) { if (this.simpleTransformationProviderBase_0 != null) { this.simpleTransformationProviderBase_0.TransformsChanged -= new EventHandler(this.method_3); } this.simpleTransformationProviderBase_0 = transformationProvider; transformationProvider.TransformsChanged += new EventHandler(this.method_3); this.simplePanInteractor_0 = new SimplePanInteractor(transformationProvider); this.simpleRotateInteractor_0 = new SimpleRotateInteractor(transformationProvider); this.simpleRectZoomInteractor_0 = new SimpleRectZoomInteractor(transformationProvider); this.simpleZoomWheelInteractor_0 = new SimpleZoomWheelInteractor(transformationProvider); this.iinteractorWinFormsDrawable_0 = (IInteractorWinFormsDrawable) new SimpleRectZoomInteractor.WinFormsDrawable(this.simpleRectZoomInteractor_0); this.iinteractorWinFormsDrawable_1 = (IInteractorWinFormsDrawable) new SimpleRotateInteractor.WinFormsDrawable(this.simpleRotateInteractor_0); }
public void initParameter() { model=null; gdiGraphics3D=null; bounds=null; //Matrix4D tempfrom2DTransform; //from2DTransform=tempfrom2DTransform; //Point tempmouseClickLocation; //mouseClickLocation=tempmouseClickLocation; mouseDown=false; shiftPressed=false; SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.UserPaint, true); GraphicsConfig graphicsConfig = new GraphicsConfig(); //graphicsConfig.BackColor = BackColor; graphicsConfig.CorrectColorForBackgroundColor = true; gdiGraphics3D = new GDIGraphics3D(graphicsConfig); bounds = new Bounds3D(); transformationProvider = new SimpleTransformationProvider3D(); transformationProvider.TransformsChanged += new EventHandler(transformationProvider_TransformsChanged); panInteractor = new SimplePanInteractor(transformationProvider); rectZoomInteractor = new SimpleRectZoomInteractor(transformationProvider); zoomWheelInteractor = new SimpleZoomWheelInteractor(transformationProvider); rectZoomInteractorDrawable = new SimpleRectZoomInteractor.WinFormsDrawable(rectZoomInteractor); }