Scroll wheel scaling in scenecontrol

Source: Internet
Author: User
Tags ipoint

(VB. NET source code)
Because scenecontrol does not respond to scroll wheel sliding events, you must first write a scroll wheel sliding event.

Axscenecontrolpolicwheel

Then, when loading, add the scroll wheel sliding handle

Addhandler me. mousewheel, addressof axscenecontrol?wheel

In this way, the scroll wheel is moved to the axscenecontrolpolicwheel.

Then write the operation statement in axscenecontrolpolicwheel.

Try
Dim psceloc as system. Drawing. Point = axscenecontrol1.pointtoscreen (Me. axscenecontrol1.location)
Dim Pt as system. Drawing. Point = me. pointtoscreen (E. Location)
If pt. x <psceloc. X or Pt. x> psceloc. x + axscenecontrol1.width or Pt. Y <psceloc. Y or Pt. Y> psceloc. Y + axscenecontrol1.height then exit sub
Dim scale as double = 0.2
If E. Delta <0 then scale =-0.2
Dim pcamera as icamera = axscenecontrol1.camera
Dim pptobs as ipoint = pcamera. Observer
Dim ppttar as ipoint = 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 ex as exception
End try

In this way, you can smoothly respond to the zoom-in and zoom-out of the scroll wheel sliding. Map and globe can also be implemented in this way. Other controls that do not support the scroll wheel event can also be implemented in this way.

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.