对WP7 GestureListener图像宽度/高度约束 [英] Constraints on Image Width/Height on WP7 GestureListener

查看:115
本文介绍了对WP7 GestureListener图像宽度/高度约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了 GestureListener 来的图像我试图让变焦这样的堆栈溢出回答此处的如何放大和WP7缩小图片?



问题是,图像不会永远停止缩放,并覆盖页面上的其他控件。这包括在页面上几个重要的按钮。



此外,它可以使图像变得如此之小,它很难让它做大,可以使图像至今熄灭的屏幕,它太硬把它带回来。



我的目标是:
保持​​在网格行它分配给形象,不能覆盖其他控件。
从越来越小
防止变得过于庞大
被拖出屏幕防止图像的宽度/高度防止图像的宽度/高度。



有没有办法解决这个问题的方法吗?在图片对象的宽度/高度不被修改 GestureListener ,所以我不能简单地做



 图像I =发件人为图像; 
如果(i.Height == TOO_BIG)
的回报;
...


解决方案

我结束了固定这一点,得到它从下面的博客中的代码完美地工作:



http://www.frenk.com/2011/03/windows-phone-7-correct-pinch-zoom-in-silverlight /



这对捏/缩放一个非常令人印象深刻的功能集。我对图像覆盖其他控件的问题是固定的,加入剪裁到电网,这将在这里详细:



http://www.codeproject.com/Articles/36495/Silverlight- ClipToBounds灿-I-夹 - 这 - 是 - 你 - Can.aspx


I added the GestureListener to an image i'm trying to have zoom like this Stack Overflow answer here: How to zoom in and zoom out Images in WP7?

The problem is that the image does not ever stop zooming, and covers other controls on the page. This covers a few important buttons on the page.

In addition, it allows the image to get so small that it's very hard to make it bigger, and allows the image to go so far off the screen where it's too hard to bring it back.

My goal is to: Keep the image in the Grid Row it's assigned to, to not cover other controls. Prevent the width/height of the image from getting to small Prevent the Width/height of getting too big Prevent the image from being dragged off the screen.

Is there a way to solve this? The Width/Height of the Image object are not modified by the GestureListener, so I cannot simply do

Image i = sender as Image;
if (i.Height == TOO_BIG)
return;
...

解决方案

I ended up fixing this and getting it work perfectly with the code from the following blog:

http://www.frenk.com/2011/03/windows-phone-7-correct-pinch-zoom-in-silverlight/

It's a very impressive set of functions for Pinch/Zoom. The issue I had about the image covering other controls was fixed by adding clipping to the Grid, which is detailed here:

http://www.codeproject.com/Articles/36495/Silverlight-ClipToBounds-Can-I-Clip-It-Yes-You-Can.aspx

这篇关于对WP7 GestureListener图像宽度/高度约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆