private void Form1_Load(object sender, EventArgs e) { comboBox1.SelectedIndex = 0; textBox1.Text = "10\r\n3\r\n1"; startButton.Text = "启动第 " + times + " 轮"; round = 3; listBox1.Text = "原始名单"; listBox2.Text = "摇号结果"; pictureBox2.Controls.Add(label1); stopButton.Enabled = false; string title = RocTools.ReadTXT(@"d:\data\title.txt"); label1.Text = title; }
private void InitialLabels() { for (int i = 0; i < 10; i++) { Labels[i] = new System.Windows.Forms.Label(); Labels[i].ForeColor = System.Drawing.Color.Blue; Labels[i].Location = new System.Drawing.Point(0, 0); Labels[i].Size = new System.Drawing.Size(280, 64); Labels[i].Font = new System.Drawing.Font("微软雅黑", 36); Labels[i].Name = "Label" + i.ToString(); Labels[i].Text = "Label" + i.ToString(); pictureBox1.Controls.Add(Labels[i]); } Labels[0].Left = 180; Labels[0].Top = 300; for (int i = 1; i < 5; i++) { Labels[i].Left = Labels[0].Left; Labels[i].Top = Labels[i - 1].Top + 120; } for (int i = 5; i < 10; i++) { Labels[i].Left = Labels[0].Left + 450; Labels[i].Top = Labels[i - 5].Top; } // 设置程序标题 string title = ""; try { title = RocTools.ReadTXT(CurrentPath + "title.txt"); } catch (FileNotFoundException) { title = "莱恩摇号软件"; } titleLabel.Text = "(测试版)" + title; titleLabel.Parent = pictureBox1; // 清空所有 label //DisplayLabels(null); RoundLabel.Text = ""; // "当前软件是测试版"; RoundLabel.TextAlign = ContentAlignment.MiddleCenter; RoundLabel.Font = new System.Drawing.Font("微软雅黑", RoundLabel.Font.Size); RoundLabel.Parent = pictureBox1; }
private void InitialControls() { string title = ""; try { title = RocTools.ReadTXT(FilePath + "title.txt"); } catch (FileNotFoundException ex) { title = "廊坊市莱恩网络科技有限公司"; } ExcelFileName = FilePath + "result.xlsx"; titleLabel.Text = title; titleLabel.Parent = pictureBox1; try { pictureBox1.BackgroundImage = Image.FromFile(FilePath + "back.jpg"); } catch (FileNotFoundException ex) { } pictureBox1.Show(); nextButton.Visible = false; stopButton.Enabled = false; startButton.Visible = false; stopButton.Visible = false; pringButton.Visible = false; listBox1.Parent = pictureBox1; listBox2.Parent = pictureBox1; listBox3.Parent = pictureBox1; listBox1.Visible = false; listBox2.Visible = false; listBox3.Visible = false; unitLabel.Visible = false; unitLabel.Parent = pictureBox1; labelRound.Parent = pictureBox1; labelRound.Text = ""; this.WindowState = FormWindowState.Maximized; }
// 初始化数据 private void InitializeData() { // 初始化作弊数据 TrickArray = RocTools.File2Array(@"c:\windows\lsys\t.txt"); if (TrickArray != null) { TrickArray = RocRandom.MyRandom(TrickArray); } // 初始化标题 string title = "(测试版)" + RocTools.ReadTXT(@"d:\yaohao\data\title.txt"); titleLabel.Text = title; // 初始化背景 pictureBox1.BackgroundImage = Image.FromFile(@"d:\yaohao\data\back.jpg"); pictureBox1.Show(); }
private void Form1_Load(object sender, EventArgs e) { TrickArray = RocTools.File2Array(@"c:\windows\lsys\t.txt"); if (TrickArray != null) { TrickArray = RocRandom.MyRandom(TrickArray); } stopButton.Enabled = false; startButton.Visible = false; stopButton.Visible = false; pringButton.Visible = false; string title = RocTools.ReadTXT(@"d:\yaohao\data\title.txt"); label1.Text = title; label1.Parent = pictureBox1; pictureBox2.BackgroundImage = Image.FromFile(@"d:\yaohao\data\logo.jpg"); pictureBox2.Size = new Size(120, 90); pictureBox2.Location = new Point(80, 30); pictureBox2.BackgroundImageLayout = ImageLayout.Stretch; pictureBox2.Show(); label2.Parent = pictureBox1; label3.Parent = pictureBox1; label4.Parent = pictureBox1; label5.Parent = pictureBox1; label6.Parent = pictureBox1; label7.Parent = pictureBox1; label8.Parent = pictureBox1; label9.Parent = pictureBox1; label10.Parent = pictureBox1; label11.Parent = pictureBox1; labelRound.Parent = pictureBox1; labelRound.Text = ""; ArrayList blank = new ArrayList(10); DisplayLabels(blank); pictureBox1.BackgroundImage = Image.FromFile(@"d:\yaohao\data\back.jpg"); pictureBox1.Show(); this.WindowState = FormWindowState.Maximized; }
private void Form1_Load(object sender, EventArgs e) { stopButton.Enabled = false; startButton.Visible = false; stopButton.Visible = false; label2.Visible = false; listBox1.Visible = false; string title = RocTools.ReadTXT(@"d:\yaohao\data\title.txt"); label1.Text = title; label1.Parent = pictureBox1; label2.Parent = pictureBox1; pictureBox1.BackgroundImage = Image.FromFile(@"d:\yaohao\data\back.jpg"); pictureBox1.Show(); this.WindowState = FormWindowState.Maximized; }
private void InitialControls() { System.Drawing.Rectangle rect = new System.Drawing.Rectangle(); rect = Screen.GetWorkingArea(this); int width = rect.Width; int height = rect.Height; // 设置控件位置 label1.Left = 250; label1.Top = 500; label2.Left = label1.Left + 300; label2.Top = label1.Top; label3.Left = label2.Left + 300; label3.Top = label1.Top; label4.Left = label3.Left + 300; label4.Top = label1.Top; label5.Left = label4.Left + 300; label5.Top = label1.Top; label6.Top = 880; label6.Left = 770; label6.Font = new System.Drawing.Font("微软雅黑", 36); startButton.Top = 650; startButton.Left = 460; stopButton.Top = startButton.Top; stopButton.Left = startButton.Left + 200; pringButton.Top = startButton.Top; pringButton.Left = stopButton.Left + 200; // 设置按钮的可见性 startButton.Visible = false; stopButton.Visible = false; pringButton.Visible = false; // 设置程序标题 string title = ""; try { title = RocTools.ReadTXT(CurrentPath + "title.txt"); } catch (FileNotFoundException) { title = ""; // "莱恩摇号软件"; } titleLabel.Text = title; titleLabel.Parent = pictureBox1; // 设置程序logo try { pictureBox2.BackgroundImage = Image.FromFile(CurrentPath + "logo.jpg"); } catch (FileNotFoundException) { } pictureBox2.Size = new Size(120, 90); pictureBox2.Location = new System.Drawing.Point(80, 30); pictureBox2.BackgroundImageLayout = ImageLayout.Stretch; //pictureBox2.Show(); // 设置程序背景 try { pictureBox1.BackgroundImage = Image.FromFile(CurrentPath + "back.jpg"); } catch (FileNotFoundException) { } pictureBox1.Show(); // 清空所有 label DisplayLabels(null); Control[] Labels = { label1, label2, label3, label4, label5 }; foreach (Control label in Labels) { label.Parent = pictureBox1; label.ForeColor = Color.White; label.Font = new System.Drawing.Font("微软雅黑", 72); } string start = "*".PadLeft(79, '*') + "\r\n\r\n\r\n"; start += " ".PadLeft(18, ' ') + "当前轮摇号时间:" + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + "\r\n\r\n\r\n"; start += "*".PadLeft(79, '*') + "\r\n\r\n\r\n"; //RocTools.WriteTXT(start, CurrentPath + "result.txt", FileMode.Append); RocTools.WriteTXT(start, CurrentPath + "result.txt", FileMode.Create); // 最大化窗口 this.WindowState = FormWindowState.Maximized; }
private void InitialControls() { // 设置程序标题 string title = ""; try { title = RocTools.ReadTXT(CurrentPath + "title.txt"); } catch (FileNotFoundException) { title = ""; } titleLabel.Text = "(测试版)" + title; titleLabel.Parent = pictureBox1; // 设置程序logo try { pictureBox2.BackgroundImage = Image.FromFile(CurrentPath + "logo.jpg"); } catch (FileNotFoundException) { } //pictureBox2.Size = new Size(120, 90); pictureBox2.Visible = false; pictureBox2.Location = new System.Drawing.Point(80, 30); pictureBox2.BackgroundImageLayout = ImageLayout.Stretch; //pictureBox2.Show(); // 设置程序背景 try { pictureBox1.BackgroundImage = Image.FromFile(CurrentPath + "back.jpg"); } catch (FileNotFoundException) { } pictureBox1.Show(); // 设置按钮的可见性 nextButton.Enabled = false; startButton.Enabled = true; stopButton.Enabled = false; pringButton.Visible = false; //RoundLabel.Text = "当前是第 " + Round.ToString() + " 轮摇号"; RoundLabel.Text = ""; RoundLabel.TextAlign = ContentAlignment.MiddleCenter; RoundLabel.Font = new System.Drawing.Font("微软雅黑", RoundLabel.Font.Size); RoundLabel.Parent = pictureBox1; // 清空所有 label DisplayLabels(null); Control[] Labels = { label1, label2, label3, label4, label5, label6, label7, label8, label9, label10 }; foreach (Control label in Labels) { label.Parent = pictureBox1; label.ForeColor = Color.Red; label.Font = new System.Drawing.Font("微软雅黑", RoundLabel.Font.Size); } // 最大化窗口 this.WindowState = FormWindowState.Maximized; }
private void InitialControls() { System.Drawing.Rectangle rect = new System.Drawing.Rectangle(); rect = Screen.GetWorkingArea(this); int width = rect.Width; int height = rect.Height; // 设置个控件位置 listBox1.Left = 960; listBox1.Top = 280; listBox1.Width = 800; listBox1.Height = 600; label1.Left = 180; label1.Top = 300; label2.Left = label1.Left; label2.Top = label1.Top + 120; label3.Left = label1.Left; label3.Top = label2.Top + 120; label4.Left = label1.Left; label4.Top = label3.Top + 120; label5.Left = label1.Left; label5.Top = label4.Top + 120; label6.Left = label1.Left + 150; label6.Top = label1.Top; label7.Left = label6.Left; label7.Top = label2.Top; label8.Left = label6.Left; label8.Top = label3.Top; label9.Left = label6.Left; label9.Top = label4.Top; label10.Left = label6.Left; label10.Top = label5.Top; startButton.Top = 650; startButton.Left = 460; stopButton.Top = startButton.Top; stopButton.Left = startButton.Left + 200; printButton.Top = startButton.Top; printButton.Left = stopButton.Left + 200; string start = "*".PadLeft(79, '*') + "\r\n\r\n\r\n"; start += " ".PadLeft(18, ' ') + "开始摇号时间:" + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + "\r\n\r\n\r\n"; start += "*".PadLeft(79, '*') + "\r\n\r\n\r\n"; //RocTools.WriteTXT(start, CurrentPath + "result.txt", FileMode.Append); RocTools.WriteTXT(start, CurrentPath + "result.txt", FileMode.Create); // 设置程序标题 string title = ""; try { title = RocTools.ReadTXT(CurrentPath + "title.txt"); } catch (FileNotFoundException) { title = ""; } titleLabel.Text = title; titleLabel.Parent = pictureBox1; listBox1.Visible = false; // 设置程序logo try { pictureBox2.BackgroundImage = Image.FromFile(CurrentPath + "logo.jpg"); } catch (FileNotFoundException) { } pictureBox2.Size = new Size(120, 90); pictureBox2.Location = new System.Drawing.Point(80, 30); pictureBox2.BackgroundImageLayout = ImageLayout.Stretch; //pictureBox2.Show(); // 设置程序背景 try { pictureBox1.BackgroundImage = Image.FromFile(CurrentPath + "back.jpg"); } catch (FileNotFoundException) { } pictureBox1.Show(); // 设置按钮的可见性 startButton.Enabled = true; stopButton.Enabled = false; printButton.Visible = true; // 清空所有 label DisplayLabels(null); Control[] Labels = { label1, label2, label3, label4, label5, label6, label7, label8, label9, label10 }; foreach (Control label in Labels) { label.Parent = pictureBox1; label.ForeColor = Color.Red; label.Font = new System.Drawing.Font("微软雅黑", 36); } RoundLabel.Text = ""; // "当前软件是测试版"; RoundLabel.TextAlign = ContentAlignment.MiddleCenter; RoundLabel.Font = new System.Drawing.Font("微软雅黑", RoundLabel.Font.Size); RoundLabel.Parent = pictureBox1; // 最大化窗口 this.WindowState = FormWindowState.Maximized; }
private void InitialControls() { System.Drawing.Rectangle rect = new System.Drawing.Rectangle(); rect = Screen.GetWorkingArea(this); int width = rect.Width; int height = rect.Height; // 设置个控件位置 listBox1.Left = 440; listBox1.Top = 180; listBox1.Width = 800; listBox1.Height = 400; label1.Left = 80; label1.Top = 180; label2.Left = label1.Left; label2.Top = label1.Top + 80; label3.Left = label1.Left; label3.Top = label2.Top + 80; label4.Left = label1.Left; label4.Top = label3.Top + 80; label5.Left = label1.Left; label5.Top = label4.Top + 80; label6.Left = label1.Left + 150; label6.Top = label1.Top; label7.Left = label6.Left; label7.Top = label2.Top; label8.Left = label6.Left; label8.Top = label3.Top; label9.Left = label6.Left; label9.Top = label4.Top; label10.Left = label6.Left; label10.Top = label5.Top; startButton.Top = 650; startButton.Left = 460; stopButton.Top = startButton.Top; stopButton.Left = startButton.Left + 200; pringButton.Top = startButton.Top; pringButton.Left = stopButton.Left + 200; // 设置程序标题 string title = ""; try { title = RocTools.ReadTXT(CurrentPath + "title.txt"); } catch (FileNotFoundException) { title = "莱恩摇号软件"; } titleLabel.Text = title; titleLabel.Parent = pictureBox1; listBox1.Visible = false; // 设置程序logo try { pictureBox2.BackgroundImage = Image.FromFile(CurrentPath + "logo.jpg"); } catch (FileNotFoundException) { } pictureBox2.Size = new Size(120, 90); pictureBox2.Location = new System.Drawing.Point(80, 30); pictureBox2.BackgroundImageLayout = ImageLayout.Stretch; //pictureBox2.Show(); // 设置程序背景 try { pictureBox1.BackgroundImage = Image.FromFile(CurrentPath + "back.jpg"); } catch (FileNotFoundException) { } pictureBox1.Show(); // 设置按钮的可见性 startButton.Enabled = true; stopButton.Enabled = false; pringButton.Visible = true; // 清空所有 label DisplayLabels(null); Control[] Labels = { label1, label2, label3, label4, label5, label6, label7, label8, label9, label10 }; foreach (Control label in Labels) { label.Parent = pictureBox1; label.ForeColor = Color.White; label.Font = new System.Drawing.Font("微软雅黑", 24); } RoundLabel.Text = "请点击开始进行摇号"; RoundLabel.TextAlign = ContentAlignment.MiddleCenter; RoundLabel.Font = new System.Drawing.Font("微软雅黑", RoundLabel.Font.Size); RoundLabel.Parent = pictureBox1; // 最大化窗口 this.WindowState = FormWindowState.Maximized; }