标签的数组 [英] Array of Labels
问题描述
如何创建标签的阵列使用Microsoft Visual C#防爆preSS版?有没有办法用图形(拖放)编辑器做,或我必须手动将其添加到自动生成的code?
How to create array of labels with Microsoft Visual C# Express Edition ? Is there way to do it with graphical (drag'n'drop) editor or I have to manually add it to auto generated code ?
推荐答案
您必须手动添加。但不要把它添加到自动生成的code,因为它可以通过Visual Studio设计被覆盖。
You have to manually add it. But don't add it to auto generated code as it can be overwritten by Visual Studio designer.
我会在Load事件处理程序中添加它的形式。在code可以是这样的:
I would add it in Load event handler for the form. The code can look like this:
Label[] labels = new Label[10];
labels[0] = new Label();
labels[0].Text = "blablabla";
labels[0].Location = new System.Drawing.Point(100, 100);
...
labels[9] = new Label();
...
PS。你的任务似乎有点不寻常的我。您想做什么?也许有更好的方法来完成你的任务。
PS. Your task seems a little unusual to me. What do you want to do? Maybe there are better ways to accomplish your task.
这篇关于标签的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!