Why does clicking in a text box cause an AutoScroll panel to scroll back to the top?(为什么单击文本框会导致 AutoScroll 面板滚动回顶部?)
问题描述
在 C# 应用程序中完成注册表单,我注意到如果我启用 AutoScroll 然后在滚动下方有一个文本框并单击它,它会一直跳回顶部.有没有办法用一些代码来解决这个问题,或者它是一种礼仪?
Finishing up a register form in a C# application and I noticed with the panel if I enable AutoScroll and then have a textbox that is below the scroll and click on it it jumps all the way back up to the top. Is there a way to fix this with some code or is it a propriety?
我很难用语言来解释它,所以这里有一个简短的视频来展示这种行为.
It's a little difficult for me to explain it in words, so here's a short video that shows the behavior.
推荐答案
我也遇到了同样的问题.我在面板中使用以下代码修复了它:
I have had the same problem. I fixed it with this code in my panel:
protected override Point ScrollToControl(Control activeControl)
{
return this.AutoScrollPosition;
}
这篇关于为什么单击文本框会导致 AutoScroll 面板滚动回顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么单击文本框会导致 AutoScroll 面板滚动回顶部?


基础教程推荐
- JSON.NET 中基于属性的类型解析 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01