for (int i = 0; i < EhphmName.Length; i++)//动态创造控件
{
TabPage page = new TabPage();
page.Text = EhphmName[i];
switch (i)
{
case 0:
break;
case 1:
int pos_x = 10, pos_y = 50;
for (int j = 0; j < EhphmGPSThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 360;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = EhphmGPSThings[j] + ":";
tempLabel.Size = new Size(80, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = EhphmGPSThings[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 120, pos_y + j * 40);
page.Controls.Add(tempTextBox);
GPSEControls.Add(tempTextBox);
}
break;
case 2:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < EhphmBD2Things.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 360;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = EhphmBD2Things[j] + ":";
tempLabel.Size = new Size(80, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = EhphmBD2Things[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 120, pos_y + j * 40);
page.Controls.Add(tempTextBox);
BD2EControls.Add(tempTextBox);
}
break;
case 3:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < EhphmGLOThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 450;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = EhphmGLOThings[j] + ":";
tempLabel.Size = new Size(100, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = EhphmGLOThings[j];
tempTextBox.Size = new Size(250, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 120, pos_y + j * 40);
page.Controls.Add(tempTextBox);
GLOEControls.Add(tempTextBox);
}
break;
case 4:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < IonutcGPSThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 450;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = IonutcGPSThings[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = IonutcGPSThings[j];
tempTextBox.Size = new Size(250, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 160, pos_y + j * 40);
page.Controls.Add(tempTextBox);
GPSIControls.Add(tempTextBox);
}
break;
case 5:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < IonutcBD2Things.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 450;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = IonutcBD2Things[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = IonutcBD2Things[j];
tempTextBox.Size = new Size(250, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 160, pos_y + j * 40);
page.Controls.Add(tempTextBox);
BD2IControls.Add(tempTextBox);
}
break;
case 6:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < GGAThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = GGAThings[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = GGAThings[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
GGAControls.Add(tempTextBox);
}
break;
case 7:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < GSAThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = GSAThings[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = GSAThings[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
GSAControls.Add(tempTextBox);
}
break;
case 8:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < GSTThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = GSTThings[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = GSTThings[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
GSTControls.Add(tempTextBox);
}
break;
case 9:
if (true)
{
TextBox tempTextBox = new TextBox();
tempTextBox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
tempTextBox.Multiline = true;
tempTextBox.Size = 数据显示.Size;
tempTextBox.Location = new Point(0, 0);
tempTextBox.Enabled = false;
page.Controls.Add(tempTextBox);
GSVControls.Add(tempTextBox);
}
break;
case 10:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < HDTThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = HDTThings[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = HDTThings[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
HDTControls.Add(tempTextBox);
}
break;
case 11:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < RMCThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = RMCThings[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = RMCThings[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
RMCControls.Add(tempTextBox);
}
break;
case 12:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < VTGThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = VTGThings[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = VTGThings[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
VTGControls.Add(tempTextBox);
}
break;
case 13:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < ZDAThings.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = ZDAThings[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = ZDAThings[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
ZDAControls.Add(tempTextBox);
}
break;
case 14:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < BestPosA.Length; j++)
{
if (j % 11 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = BestPosA[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = BestPosA[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
BestPosAControls.Add(tempTextBox);
}
break;
case 15:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < BestVelA.Length; j++)
{
if (j % 11 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = BestVelA[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = BestVelA[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
BestVelAControls.Add(tempTextBox);
}
break;
case 16:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < HeadingMessage.Length; j++)
{
if (j % 11 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = HeadingMessage[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = HeadingMessage[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
HeadingMessageControls.Add(tempTextBox);
}
break;
case 17:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < PsrDopA.Length; j++)
{
if (j % 10 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = PsrDopA[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = PsrDopA[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
PsrDopaControls.Add(tempTextBox);
if (j == PsrDopA.Length - 1)
{
tempTextBox.Size = new Size(600, 10);
}
}
break;
case 18:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < PsrPos.Length; j++)
{
if (j % 11 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = PsrPos[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = PsrPos[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
PsrPosControls.Add(tempTextBox);
}
break;
case 19:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < PsrVel.Length; j++)
{
if (j % 11 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = PsrVel[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = PsrVel[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
PsrVelControls.Add(tempTextBox);
}
break;
case 20:
if (true)
{
TextBox tempTextBox = new TextBox();
tempTextBox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
tempTextBox.Multiline = true;
tempTextBox.Size = 数据显示.Size;
tempTextBox.Location = new Point(0, 0);
tempTextBox.Enabled = false;
page.Controls.Add(tempTextBox);
RangeControls.Add(tempTextBox);
}
break;
case 21:
if (true)
{
TextBox tempTextBox = new TextBox();
tempTextBox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
tempTextBox.Multiline = true;
tempTextBox.Size = 数据显示.Size;
tempTextBox.Location = new Point(0, 0);
tempTextBox.Enabled = false;
page.Controls.Add(tempTextBox);
SatVisControls.Add(tempTextBox);
}
break;
case 22:
pos_x = 10;
pos_y = 50;
for (int j = 0; j < RefStaTionA.Length; j++)
{
if (j % 11 == 0 && j != 0)
{
pos_x += 400;
pos_y -= 400;
}
Label tempLabel = new Label();
tempLabel.Text = RefStaTionA[j] + ":";
tempLabel.Size = new Size(160, 30);
tempLabel.Font = font;
tempLabel.Location = new Point(pos_x, pos_y + j * 40);
page.Controls.Add(tempLabel);
TextBox tempTextBox = new TextBox();
tempTextBox.Name = RefStaTionA[j];
tempTextBox.Size = new Size(200, 10);
tempTextBox.Font = font;
tempTextBox.Location = new Point(pos_x + 180, pos_y + j * 40);
page.Controls.Add(tempTextBox);
RefStaTionAControls.Add(tempTextBox);
}
break;
}
数据显示.TabPages.Add(page);
}
C#_代码生成控件,并放置再其他控件上
最新推荐文章于 2023-10-08 17:38:46 发布