Private Void Axscenecontrol_onmousewheel ( Object Sender, mouseeventargs e ){ Try {System. Drawing. Point psceloc = Axscenecontrol1.pointtoscreen ( This . Axscenecontrol1.location); system. Drawing. Point PT = This . Pointtoscreen (E. Location ); If (Pt. x <psceloc. x | pt. x> psceloc. x + axscenecontrol1.width | pt. Y <psceloc. Y | pt. Y> psceloc. Y + Axscenecontrol1.height ){ Return ;} Double Scale = 0.2 ; If (E. Delta < 0 ) Scale =- 0.2 ; Icamera pcamera =Axscenecontrol1.camera; ipoint pptobs = Pcamera. Observer; ipoint ppttar = Pcamera. Target; pptobs. x + = (Pptobs. X-ppttar. X )* Scale; pptobs. Y + = (Pptobs. Y-ppttar. Y )* Scale; pptobs. Z + = (Pptobs. Z-ppttar. Z )* Scale; pcamera. Observer = Pptobs; axscenecontrol1.scenegraph. refreshviewers ();} Catch {}}
// Add a scroll event
This. Mousewheel + =NewSystem. Windows. Forms. mouseeventhandler (axscenecontrol_onmousewheel );