private void bRotate_Click(object sender, EventArgs e) { if (checkRotateValue(tbRotateValue.Text)) { RotateHandler rh = new RotateHandler(); pbPicture.Image = rh.toRotate(pbPicture.Image, int.Parse(tbRotateValue.Text)); } else { MessageBox.Show("Rotate value empty", "Rotate value Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } }
/// <summary> /// Initializes a new instance of the <see cref="Viewport3DX" /> class. /// </summary> public Viewport3DX() { this.perspectiveCamera = new PerspectiveCamera(); this.orthographicCamera = new OrthographicCamera(); this.perspectiveCamera.Reset(); this.orthographicCamera.Reset(); this.Camera = this.Orthographic ? (ProjectionCamera)this.orthographicCamera : this.perspectiveCamera; //this.Children = new Element3DCollection(); this.rotateHandler = new RotateHandler(this); this.panHandler = new PanHandler(this); this.zoomHandler = new ZoomHandler(this); this.changeFieldOfViewHandler = new ZoomHandler(this, true); this.zoomRectangleHandler = new ZoomRectangleHandler(this); this.CommandBindings.Add(new CommandBinding(ViewportCommands.ZoomExtents, this.ZoomExtentsHandler)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.SetTarget, this.SetTargetHandler)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.Reset, this.ResetHandler)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.Zoom, this.zoomHandler.Execute)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.Pan, this.panHandler.Execute)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.Rotate, this.rotateHandler.Execute)); this.CommandBindings.Add( new CommandBinding(ViewportCommands.ChangeFieldOfView, this.changeFieldOfViewHandler.Execute)); this.CommandBindings.Add( new CommandBinding(ViewportCommands.ZoomRectangle, this.zoomRectangleHandler.Execute)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.BottomView, this.BottomViewHandler)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.TopView, this.TopViewHandler)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.FrontView, this.FrontViewHandler)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.BackView, this.BackViewHandler)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.LeftView, this.LeftViewHandler)); this.CommandBindings.Add(new CommandBinding(ViewportCommands.RightView, this.RightViewHandler)); this.SetDefaultGestures(); this.fpsWatch.Start(); this.renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering); this.Loaded += this.ControlLoaded; this.Unloaded += this.ControlUnloaded; }
/// <summary> /// Initializes the input bindings. /// </summary> private void InitializeBindings() { this.CommandBindings.Clear(); this.changeLookAtHandler = new RotateHandler(this.Viewport, true); this.rotateHandler = new RotateHandler(this.Viewport); this.zoomRectangleHandler = new ZoomRectangleHandler(this.Viewport); this.zoomHandler = new ZoomHandler(this.Viewport); this.panHandler = new PanHandler(this.Viewport); this.changeFieldOfViewHandler = new ZoomHandler(this.Viewport, true); this.CommandBindings.Add(new CommandBinding(ZoomRectangleCommand, this.zoomRectangleHandler.Execute)); this.CommandBindings.Add(new CommandBinding(ZoomExtentsCommand, this.ZoomExtentsHandler)); this.CommandBindings.Add(new CommandBinding(RotateCommand, this.rotateHandler.Execute)); this.CommandBindings.Add(new CommandBinding(ZoomCommand, this.zoomHandler.Execute)); this.CommandBindings.Add(new CommandBinding(PanCommand, this.panHandler.Execute)); this.CommandBindings.Add(new CommandBinding(ResetCameraCommand, this.ResetCameraHandler)); this.CommandBindings.Add(new CommandBinding(ChangeLookAtCommand, this.changeLookAtHandler.Execute)); this.CommandBindings.Add( new CommandBinding(ChangeFieldOfViewCommand, this.changeFieldOfViewHandler.Execute)); this.CommandBindings.Add(new CommandBinding(TopViewCommand, this.TopViewHandler)); this.CommandBindings.Add(new CommandBinding(BottomViewCommand, this.BottomViewHandler)); this.CommandBindings.Add(new CommandBinding(LeftViewCommand, this.LeftViewHandler)); this.CommandBindings.Add(new CommandBinding(RightViewCommand, this.RightViewHandler)); this.CommandBindings.Add(new CommandBinding(FrontViewCommand, this.FrontViewHandler)); this.CommandBindings.Add(new CommandBinding(BackViewCommand, this.BackViewHandler)); }