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 面板滚动回顶部?


- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01
- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01
- 带问号的 nvarchar 列结果 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01
- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- 使用 rss + c# 2022-01-01
- 在 LINQ to SQL 中使用 contains() 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01