gpt4 book ai didi

c# - 动态控件不显示

转载 作者:行者123 更新时间:2023-11-30 14:15:13 24 4
gpt4 key购买 nike

我试图将动态标签彼此非常接近地分组,但是当我这样做并在标签中输入文本时,它们在我运行代码时不显示。它什么也没显示,就好像它没有打印一样。我想知道如何将动态标签彼此靠近分组。

创建的第一个动态标签:

Label l = new Label();
System.Drawing.Point l0 = new System.Drawing.Point(15, 48 + z);
l.Location = l0;
l.Text = textReader.Value.ToString();
l.AutoSize = true;
l.MaximumSize = new Size(120, 50);
z+= 35;

创建的第二个动态标签:

System.Drawing.Point l1 = new System.Drawing.Point(65, 48 + x);
l2.Location = l1;
l2.Text = textReader.Value.ToString();
l2.AutoSize = true;
l2.MaximumSize = new Size(120, 50);
x += 35;

最佳答案

您必须将控件添加到窗体。

Form1.Controls.Add(l);
Form1.Controls.Add(l2);

关于c# - 动态控件不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10397136/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com