Handling size of image after orientation change WP7

时间秒杀一切 提交于 2019-12-07 21:00:24

问题


I've got an Image with an overlay Canvas with some rectangles whose position is relative to image's size. The problem comes when I change the phone orientation, because image size changes (or at least, the renderization) but I can't manage to re-distribute the rectangles according to the new size, and the OrientationChanged event doesn't help me because it's fired before rendering the image (so all the rectangles go to (0,0))

Anyone can help me finding the correct event?


回答1:


I'd either not use percentage widths or save them as exact values when first rendered/measured for one orientation. You can then adjust the dimensions relative to the orientation.

Update
If you can't get the exact values passed to you then you coudl load the image where teh user can't see it to measure it.

If you're getting the image and positions from an external source which always assumes a portrait orientation then why not just always display it as such in your app.




回答2:


Finally got it!

The event I was looking for was the SizeChanged, I can't imagine how I didn't see it before...



来源:https://stackoverflow.com/questions/6857142/handling-size-of-image-after-orientation-change-wp7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!