Scenecontrol + AE + scroll wheel Scaling

Source: Internet
Author: User
Tags ipoint

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 );
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.