WP7 - 当方向改变时仅旋转某些对象

发布于 2024-12-02 05:05:43 字数 272 浏览 0 评论 0原文

当方向改变时,有什么方法可以阻止控件(或控件组)旋转?

我不需要旋转我的游戏板,但如果屏幕的其余部分(其他 GUI 元素,如弹出窗口等)自动旋转,我就不必手动旋转它们,这会很方便。

我知道我可以改变所有东西的方向,然后使用 RotateTransform 仅通过 GameBoard 旋转画布,但是很难找到它的中心点并正确旋转它。

编辑:现在我看到,如果我想要自动改变某些控件的方向,我将自己旋转游戏板。那么有没有简单的方法可以找到控件 RotateTransform 的中心点呢?

Is there any way to stop a control (or group of them) from rotating when the orientation changes?

I need to not rotate my gameboard, but it would by handy if the rest of screen (other GUI elements like pop up windows etc.) rotates automatically and I wouldn't have to rotate them manually.

I know that I can change orientation of everything and than rotate only the canvas with GameBoard using RotateTransform, but it's kinda hard to find center point of it and rotate it properly.

EDIT: Now i see that if I want automatic orientation changing of some control I'll have rotate my gameboard by myself. So is there any easy way to find centrer point for RotateTransform of a control?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄情伤 2024-12-09 05:05:43

我认为你必须手动执行此操作。您说的是 Silverlight 而不是 XNA,对吗? Silverlight 将尽力为您轮换内容。简单地更改方向将导致 Silverlight 使用新的屏幕尺寸(以及翻转的设备轴)自然地再次执行布局。

如果您希望控件保持方向,则必须手动旋转控件。

这可能有用:

该页面底部有一个 PDF 链接,该链接可能也很有用。但我担心您将不得不手动旋转它们。

您也可以考虑锁定方向。

I think you have to do this manually. You're talking Silverlight rather than XNA right? Silverlight will do its best to rotate stuff for you. Simply changing the orientation will cause Silverlight to naturally perform layout again with the new screen dimensions (and device axis flipped).

You will have to perform a manual rotation on the controls if you want them to stay oriented.

This may be useful:
http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/04/08/automatic-rotation-support-or-automatic-multi-orientation-layout-support-for-windows-phone.aspx

There's a link to a PDF that might also be useful at the bottom of that page. However I fear you will have to manually rotate them.

You could consider locking the orientation too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文