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


基础教程推荐
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01