当前位置:网站首页>wpf ScrowViewer水平滚动
wpf ScrowViewer水平滚动
2022-07-31 05:09:00 【JOJOL1N】
首先,设置正常的scrollViewer,里面套一个Grid
<ScrollViewer x:Name="sv"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Grid.Row="1"
Height="33"
Grid.Column="0" >
<Grid x:Name="appTabControl"
VerticalAlignment="Stretch" MouseWheel="appTabControl_MouseWheel"
Height="33"
>
</Grid>
</ScrollViewer>然后,根据鼠标滚轮事件的delta参数来设置scrollViewer的ScrollToHorizontalOffset方法来进行移动,注意:鼠标滚轮事件必须是Grid的,如果是ScrollViewer的鼠标滚轮事件则无作用。
private void appTabControl_MouseWheel(object sender, MouseWheelEventArgs e)
{
//sv是scrollViewer
sv.ScrollToHorizontalOffset(-e.Delta);
}参数e.Delta可以根据开发需要来设置正负号,进行滚轮方向的调整。
懒得弄gif,没有效果演示
边栏推荐
- 三子棋讲解(C语言)
- With MVC, why DDD?
- Pytorch教程Introduction中的神经网络实现示例
- MySQL8.0.26安装配置教程(windows 64位)
- C语言指针详解
- torch.normal函数用法
- Kubernetes 证书可用年限修改
- Lock wait timeout exceeded解决方案
- Moment Pool Cloud quickly installs packages such as torch-sparse and torch-geometric
- Input length must be multiple of 8 when decrypting with padded cipher
猜你喜欢

数据库上机实验7 数据库设计

Sword Point Offer Special Assault Edition ---- Day 1

Sword Point Offer Special Assault Edition ---- Day 2

About the problems encountered by Xiaobai installing nodejs (npm WARN config global `--global`, `--local` are deprecated. Use `--location=glob)

With MVC, why DDD?

Temporal介绍

剑指offer专项突击版 --- 第 4 天

剑指offer专项突击版 --- 第 3 天

基于web3.0使用钱包Metamask的三方登陆
【一起学Rust】Rust学习前准备——注释和格式化输出
随机推荐
Redis Advanced - Cache Issues: Consistency, Penetration, Penetration, Avalanche, Pollution, etc.
数据库上机实验3 连接查询和分组查询
Temporal客户端模型
MySQL_关于JSON数据的查询
面试官竟然问我怎么分库分表?幸亏我总结了一套八股文
Goodbye to the cumbersome Excel, mastering data analysis and processing technology depends on it
C语言实验四 循环结构程序设计(一)
面试官,不要再问我三次握手和四次挥手
Flink sink ES 写入 ES(带密码)
tf.keras.utils.get_file()
Distributed transaction processing solution big PK!
C语言教程(三)-if和循环
Typec手机有线网卡网线转网口转接口快充方案
数据库上机实验7 数据库设计
matlab simulink欠驱动水面船舶航迹自抗扰控制研究
Simple command of mysql
梳理一下自己常用的快捷键
Proteus 8 Professional安装教程
Redis的初识
剑指offer基础版 ----- 第25天