Scenecontrol + AE + scroll wheel Scaling
To set the scroll wheel scaling for scenecontrol, you must define the delegation. Because scenecontrol does not have a wheel event, the from wheel event must be delegated.
Public form1 ()
{
Initializecomponent ();
This. mousewheel + = new mouseeventhandler (this. sc1_wheel); // enter "This. mousewheel + =" in this place and press the tab key twice in a row.
}
Private void sc1_wheel (Object sender, system. Windows. Forms. mouseeventargs E)
{
Try
{
Psc1.mousepointer = esricontrolsmousepointer. esripointerzoom;
System. Drawing. Point pscenelocation = sc1.pointtoscreen (sc1.location );
System. Drawing. Point Pt = This. pointtoscreen (E. Location );
If (Pt. x <pscenelocation. x | pt. x> pscenelocation. x + sc1.width | pt. Y <pscenelocation. Y | pt. Y> pscenelocation. Y + sc1.height)
Return;
Double scale = 0.2;
If (E. Delta <0) size =-0.2;
Icamera pcamera = sc1.camera;
Ipoint pobserver = pcamera. observer;
Ipoint pTARGET = pcamera. target;
Pobserver. x + = (pobserver. X-pTARGET. X) * scale;
Pobserver. Y + = (pobserver. Y-pTARGET. Y) * scale;
Pobserver. Z + = (pobserver. Z-pTARGET. Z) * scale;
Pcamera. Observer = pobserver;
Psc1.scenegraph. refreshviewers ();
This. Text = E. Delta. tostring ();
}
Catch (exception ex)
{
MessageBox. Show (ex. Message );
}
}