【发布时间】:2020-11-20 12:54:57
【问题描述】:
public partial class Form1 : Form
{
public System.Windows.Forms.ScrollBars ScrollBars { get; set; }
private int startingY = 0;
private GroupBox lastGB = null;
private int timerCounter = 0;
public Form1()
{
InitializeComponent();
textBox1.SizeChanged += (s, e) => { UpdateLabelPositions(); };
textBox1.LocationChanged += (s, e) => { UpdateLabelPositions(); };
this.Shown += (s, e) => { UpdateLabelPositions(); };
textBox1.Multiline = true;
textBox1.ScrollBars = ScrollBars.Vertical;
}
但即使我向其中添加了许多项目,文本框滚动条也会灰显禁用。
我向文本框添加了许多组框,但就像在屏幕截图中一样,它们被添加到文本框内,并且文本框没有启用滚动条。我还尝试在设计器中将滚动条设置为 BOTH,但它没有改变任何东西。
【问题讨论】:
-
等等.. 你要在 TextBox 中添加控件?为什么不使用像 Panel 这样的合适容器?
-
@Martheen 我将其更改为面板,但它仍然没有滚动。而且我无法在面板的设计器中找到在哪里以及如何设置和启用滚动条。但与以前的文本框一样,面板也没有滚动条。