有没有办法将按钮链接到滑块? [英] Is there a way to link a button to a slider?

查看:112
本文介绍了有没有办法将按钮链接到滑块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个图像查看器,它可以使用滑块和按钮缩放图像。我能够通过使用Tick设置为.25,.50一直到2的滑块来实现这一目标,这将是25%到200%的图像比例。但我还想实现一个放大和缩小按钮(就像Microsoft Paint一样),点击它时会使滑块箭头移动到下一个或上一个刻度线(取决于放大或缩小),从而增加或减少图像比例25%。我是WPF的新手,所以我不熟悉我可以使用的所有属性,但我读到使用Storyboard动画可能会有效。这是否可行,如何做到这一点,还是有其他方法可以用来实现我的目标。

I’m trying to create an image viewer which would be able to zoom an image in and out with the use of both slider and button. I was able to accomplish this by using a slider which Tick is set as .25,.50 all the way up to 2 which would be a 25% to 200% image scale. But I would also like to implement a zoom in and out button (just like Microsoft Paint) that when clicked would make the slider arrow move to the next or previous tick (depending if zoom in or out) thus incrementing or decrementing the image scale by 25%. I’m new to WPF so I’m not familiar with all the properties I could use but I read that animating with the use of Storyboard might work. Would this be viable and how would this be done or are there other method I could use to accomplish my goals.

推荐答案

试试这些链接 -

WPF - 如何将ScaleTransform绑定到Slider,百分比样式! [ ^ ]

ScrollViewer中的WPF简单缩放和拖动支持 [ ^ ]

使用WPF进行UI缩放(UI缩放) [ ^ ]
Try these links -
WPF — how to bind ScaleTransform to Slider, percentage style![^]
WPF simple zoom and drag support in a ScrollViewer[^]
UI Scaling (UI Zooming) with WPF[^]


这篇关于有没有办法将按钮链接到滑块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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