17,740
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AGaugeApp
{
public partial class Form4 : Form
{
private int[] x = { 21, 212, 403, 594, 785, 976 };
private int y = 0;
protected Label[] La_txt;
protected UStation[][] Station;
int[] SCONUT = { 16, 15, 12, 14, 14, 16, 18 };
const int COUNT=7;
public Form4()
{
InitializeComponent();
this.BackColor = System.Drawing.Color.FromArgb(53, 53, 53);
panel2.VerticalScroll.SmallChange = 10;
InitStation();
}
protected void InitStation()
{
La_txt = new Label[COUNT];
Station = new UStation[COUNT][];
for (int i = 0; i < COUNT; i++)
{
La_txt[i]=new Label();
La_txt[i].Font = new System.Drawing.Font("楷体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
La_txt[i].ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
La_txt[i].Location = new System.Drawing.Point(0, y);
La_txt[i].Size = new System.Drawing.Size(106, 29);
La_txt[i].Text = "前桥线";
y += La_txt[i].Height + 3;
Station[i] = new UStation[SCONUT[i]];
this.panel2.Controls.Add(La_txt[i]);
for (int j = 0; j < SCONUT[i]; j++)
{
Station[i][j] = new UStation();
Station[i][j].Location = new System.Drawing.Point(x[j % 6], y);
if (j % 6 == 5)
{
y += 70 + 3;
}
if (j % 6 == 3)
{
Station[i][j].SetRun();
}
this.panel2.Controls.Add(Station[i][j]);
}
if (SCONUT[i] % 6 != 0)
{
y += 70 + 3;
}
}
}
}
}