我可以绑定到Ctrl+C或Ctrl+LeftClick,但是如何绑定到鼠标/滚轮操作?
我试图做一些像增加/减少字体大小的事情,就像在浏览器中一样.
我想设置Ctrl+MWheelUp增加字体大小
Luk*_*don 24
在构造函数中向PreviewMouseWheel添加事件
PreviewMouseWheel += Window_PreviewMouseWheel;
Run Code Online (Sandbox Code Playgroud)
然后在处理程序中检测密钥
private void Window_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if (Keyboard.Modifiers != ModifierKeys.Control)
return;
if (e.Delta > 0)
ZoomIn();
else if (e.Delta < 0)
ZoomOut();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4837 次 |
| 最近记录: |