鼠标点击放大 Silverlight 2.0
我想在鼠标单击发生的地方精确地放大/缩小图像。整个图像应缩放,但当前视图应显示鼠标单击发生的部分,并且滚动条也应可用于查看其他部分。
我尝试使用滚动查看器并将图像控件放在其中。单击鼠标时,我使用 RenderTransform 并在每次用户单击“放大”时将比例增加 1。图像正在放大,但视图不在鼠标单击发生的位置。
请帮忙!
谢谢 赛伊
I would like to zoom in/out an image exactly where mouse click occurs. Whole image should be zoomed but current view should show the part where mouse click happened and scrollbar should be available for seeing other parts as well.
I tried using scrollviewer and placed my image control inside it. On mouse click am using RenderTransform and increasing the scale by 1 everytime user clicks for Zoom in.Image is getting zoomed-in but view is not at the place where mouse click occured.
Please help!
THanks
Sai
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要设置 基于鼠标位置的
RenderTransformOrigin
属性。您需要将鼠标位置转换为图像的坐标,以获得正确的原点,并通过将位置除以图像的尺寸来标准化这些值,使它们位于 0 到 1 的范围内。
You need to set the
RenderTransformOrigin
property based on the mouse location.You will need to convert your mouse location to the coordinates of the image to get the correct origin and normalize the values so that they are in the range 0 to 1 by dividing the position by the dimensions of the image.