C#图片框循环
我已经为图片框编写了循环,它看起来像这样:C#图片框循环,c#,winforms,C#,Winforms,我已经为图片框编写了循环,它看起来像这样: void labelAdder() { List<Label> labels = new List<Label>(); List<TextBox> texboxex = new List<TextBox>(); List<PictureBox> pictureBoxes = new List<PictureBox>(); for (int i =
void labelAdder()
{
List<Label> labels = new List<Label>();
List<TextBox> texboxex = new List<TextBox>();
List<PictureBox> pictureBoxes = new List<PictureBox>();
for (int i = 0; i < args.Length - 1; i++)
{
equals++;
var temp = new TextBox();
var temp2 = new PictureBox();
int x = 10;
int y = xD * equals;
temp.Location = new Point(x, y);
temp2.Location = new Point(x + 100, y);
temp2.Image = global::Xbox360_Complex_Checker.Properties.Resources.button_offline;
temp.Text = args[i];
temp2.Text = status[i];
this.Controls.Add(temp);
this.Controls.Add(temp2);
temp.Show();
temp2.Show();
texboxex.Add(temp);
pictureBoxes.Add(temp2);
}
}
void labelAdder()
{
列表标签=新列表();
List texboxex=新列表();
List pictureBoxes=新列表();
for(int i=0;i
我的问题是,
PictureBox
只在第一个textBox
旁边加载,它应该在所有文本框旁边加载。我不知道为什么它不起作用。我用标签试过了,标签加载正常。欢迎!这是WinForms吗?如果是这样的话,你应该给它加上标签,这样合适的用户界面技术专家就会被你的问题吸引过来。你应该使用复合控件或用户控件来解决这样的问题:尝试在表单上关联单独的控件会为你省下很多麻烦。有没有pictureBox的示例|我不能再责备它了。您的xD
变量未记录。此外,考虑使用更好的变量名。code>temp和temp2
不能帮助编码人员了解他们在使用什么。如前所述,一个带有PictureBox和TextBox的用户控件将使其更容易使用FlowLayoutPanel,这样您就不需要这种放置逻辑了。