简体   繁体   中英

DirectManipulation ScrollTo functionality

I am writing a Win32 application (C++) using DirectComposition and DirectManipulation . I have sucessfully created a my own Scroll View control by setting viewport and content visuals.

It all works nicely, yet I cannot seem to figure out how to programmatically move the content in the viewport. I would like to create ScrollTo behavior where you can bring some content into view.

I've been fiddling around with SyncContentTransform but it doesn't seem to do anything. Do I need to call some other function to commit the sync? Documentation and examples barely exist, I am hoping someone can help me out.

I have figured this out myself. You should use the ZoomToRect method on the viewport object to scroll the content programmatically. I was ignoring this method because it stated "Zoom". Doh.

Here is a link to the function: https://docs.microsoft.com/en-us/windows/win32/api/directmanipulation/nf-directmanipulation-idirectmanipulationviewport-zoomtorect

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM