コード例 #1
0
 private void InitialTrickData()
 {
     /*
      * 用于分组内定,数据格式如下:
      * 2 张三 李四 王五
      * 5 赵柳 韩七 马八
      * 表示第二轮和第五轮摇号会出现的人
      * try
      * {
      *  ArrayList tArray = RocTools.File2Array(@"C:\driver\disk.txt");
      *
      *  Dictionary<string, ArrayList> dic = new Dictionary<string, ArrayList>();
      *  foreach (string str in tArray)
      *  {
      *      string[] strs = str.Split(' ');
      *      ArrayList temp = new ArrayList();
      *      for (int i = 1; i < strs.Length; i++)
      *      {
      *          temp.Add(strs[i]);
      *      }
      *      dic.Add(strs[0], temp);
      *  }
      * }
      * catch (Exception)
      * {
      * }
      */
     try
     {
         TrickArray = RocTools.File2Array(@"C:\driver\disk.txt");
     }
     catch (Exception)
     {
     }
 }
コード例 #2
0
        private void 加载初始数据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.CheckFileExists = true;
            ofd.CheckPathExists = true;
            ofd.ValidateNames   = true;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                OriginPeopleAl = RocTools.File2Array(ofd.FileName);
                listBox1.Items.Clear();
                foreach (object o in OriginPeopleAl)
                {
                    listBox1.Items.Add(o.ToString());
                }
            }
            listBox1.Visible = true;
            //listBox1.Left = 100;
            //listBox1.Top = 200;
            //listBox1.Size = new Size(500, 800);

            //label2.Left = 700;
            //label2.Top = 500;
            filename = Path.GetFileNameWithoutExtension(ofd.FileName);

            //startButton.Left = 1000;
            //startButton.Top = 880;
            //stopButton.Left = 1300;
            //stopButton.Top = 880;
            startButton.Visible = true;
            stopButton.Visible  = true;
            label2.Text         = "点击开始启动摇号";
            label2.Visible      = true;
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: computer0316/windows
        private void Trick()
        {
            // 读取作弊文件
            ArrayList TrickArray = RocTools.File2Array(CurrentPath + "name.txt");

            // 设置 CurrentArray
            int i = 0;

            foreach (object obj in TrickArray)
            {
                if (CurrentArray.IndexOf(obj) == -1)
                {
                    CurrentArray[i] = TrickArray[i];
                }
                i++;
                if (i > 9)
                {
                    break;
                }
            }

            // 显示当前结果
            DisplayLabels(CurrentArray);
            RocTools.WriteTXT("", CurrentPath + "name.txt", FileMode.Create);
        }
コード例 #4
0
        private void InitialPrintMessage()
        {
            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.Create);
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: computer0316/windows
 private void SaveResult()
 {
     RocTools.WriteTXT("当前摇号时间 " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(), CurrentPath + "result.txt", FileMode.Append);
     foreach (object obj in CurrentArray)
     {
         RocTools.WriteTXT("\t" + obj.ToString(), CurrentPath + "result.txt", FileMode.Append);
     }
 }
コード例 #6
0
 private void InitialBaseData()
 {
     MainArray = RocTools.File2Array(CurrentPath + "source.txt");
     if (MainArray == null)
     {
         MessageBox.Show("读取原始数据错误。");
     }
 }
コード例 #7
0
        private void save(ListBox listBox)
        {
            string str = "第 " + (times - 1).ToString() + " 轮摇号结果:\r\n";

            foreach (object o in listBox.Items)
            {
                str += o.ToString() + "\r\n";
            }
            RocTools.WriteTXT(str, @"d:\data\" + filename + ".txt", FileMode.Append);
            resultLabel.Text = @"d:\data\" + filename + ".txt";
        }
コード例 #8
0
        private void SaveResult(ArrayList Curr)
        {
            RocTools.WriteTXT("以下是第 " + round + " 轮摇号结果:\n", @"d:\yaohao\result\" + filename + ".txt", FileMode.Append);
            int count = 0;

            foreach (string str in Curr)
            {
                count++;
                RocTools.WriteTXT(((round - 1) * 10 + count).ToString() + " " + str + "\n", @"d:\yaohao\result\" + filename + ".txt", FileMode.Append);
            }
        }
コード例 #9
0
 private void scroll()
 {
     while (!Stop)
     {
         ArrayList Origin  = RocTools.ArrayListCopy(OriginPeopleAl);
         ArrayList Current = RocRandom.MyRandom(Origin);
         label2.Text = Current[0].ToString();
         Thread.Sleep(50);
         Application.DoEvents();
     }
 }
コード例 #10
0
ファイル: Form1.cs プロジェクト: computer0316/windows
 // 控制程序单一运行
 private void SingleProgramLock()
 {
     if (File.Exists(SingleStartFileName))
     {
         Environment.Exit(0);
     }
     else
     {
         RocTools.WriteTXT("摇号程序单一启动控制文件", SingleStartFileName, FileMode.Create);
     }
 }
コード例 #11
0
ファイル: Form1.cs プロジェクト: computer0316/windows
        private void SaveResult()
        {
            //RocTools.WriteTXT("当前摇号时间 " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(), CurrentPath + "result.txt", FileMode.Append);
            Control[] Label = { label1, label2, label3, label4, label5 };
            string    str   = "";

            for (int i = 0; i < ShowCount; i++)
            {
                str += Label[i].Text + " ";
            }
            RocTools.WriteTXT("第 " + Round.ToString() + " 轮摇号结果:" + str + "\r\n", CurrentPath + "result.txt", FileMode.Append);
        }
コード例 #12
0
        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;
        }
コード例 #13
0
ファイル: Form1.cs プロジェクト: computer0316/windows
        private void InitialData()
        {
            ArrayA = RocTools.File2Array(CurrentPath + "a.txt");
            ArrayB = RocTools.File2Array(CurrentPath + "b.txt");
            if (ArrayA == null || ArrayB == null)
            {
                MessageBox.Show("读取原始数据错误。");
            }
            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);
        }
コード例 #14
0
        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;
        }
コード例 #15
0
ファイル: Form1.cs プロジェクト: computer0316/windows
        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;
        }
コード例 #16
0
        // 初始化数据
        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();
        }
コード例 #17
0
        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;
        }
コード例 #18
0
        private void SaveResult()
        {
            //RocTools.WriteTXT("当前摇号时间 " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(), CurrentPath + "result.txt", FileMode.Append);
            Control[] Label = { label1, label2, label3, label4, label5, label6, label7, label8, label9, label10 };
            string    str   = "";

            for (int i = 0; i < ShowCount; i++)
            {
                str += Label[i].Text + " ";
            }
            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);
            RocTools.WriteTXT("第 " + Round.ToString() + " 轮摇号结果:" + str + "\r\n", CurrentPath + "result.txt", FileMode.Append);
        }
コード例 #19
0
        private void 加载初始数据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                CheckFileExists = true,
                CheckPathExists = true,
                ValidateNames   = true
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                CurrentArray = RocTools.File2Array(ofd.FileName);
            }
            filename = Path.GetFileNameWithoutExtension(ofd.FileName);
            RocTools.WriteTXT("摇号结果:\n", @"d:\yaohao\result\" + filename + ".txt", FileMode.Create);
            startButton.Visible = true;
            stopButton.Visible  = true;
        }
コード例 #20
0
        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;
        }
コード例 #21
0
        private void scroll()
        {
            string[] countStr = textBox1.Text.Split("\n".ToCharArray());
            int      count    = 0;

            count = int.Parse(countStr[times - 1]);
            while (!Stop)
            {
                ArrayList Origin  = RocTools.ArrayListCopy(OriginPeopleAl);
                ArrayList Current = RocRandom.MyRandom(Origin);
                listBox2.Items.Clear();
                for (int i = 0; i < count; i++)
                {
                    listBox2.Items.Add(Current[i].ToString());
                }
                Thread.Sleep(50);
                Application.DoEvents();
            }
        }
コード例 #22
0
        private void LoadButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.CheckFileExists = true;
            ofd.CheckPathExists = true;
            ofd.ValidateNames   = true;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                OriginPeopleAl = RocTools.File2Array(ofd.FileName);
                listBox1.Items.Clear();
                foreach (object o in OriginPeopleAl)
                {
                    listBox1.Items.Add(o.ToString());
                }
            }
            filename = Path.GetFileNameWithoutExtension(ofd.FileName);
            RocTools.WriteTXT("", @"d:\data\" + filename + ".txt", FileMode.Create);
            sourceLabel.Text = ofd.FileName;
        }
コード例 #23
0
ファイル: Form1.cs プロジェクト: computer0316/windows
        private Dictionary <string, ArrayList> InitTrick()
        {
            try
            {
                ArrayList tArray = RocTools.File2Array(@"C:\driver\disk.txt");

                Dictionary <string, ArrayList> dic = new Dictionary <string, ArrayList>();
                foreach (string str in tArray)
                {
                    string[]  strs = str.Split(' ');
                    ArrayList temp = new ArrayList();
                    for (int i = 1; i < strs.Length; i++)
                    {
                        temp.Add(strs[i]);
                    }
                    dic.Add(strs[0], temp);
                }
                return(dic);
            }
            catch (Exception)
            {
                return(null);
            }
        }
コード例 #24
0
 private void save(string str)
 {
     RocTools.WriteTXT(str, @"d:\yaohao\result\" + filename + ".txt", FileMode.Create);
 }
コード例 #25
0
ファイル: Form1.cs プロジェクト: computer0316/windows
        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;
        }
コード例 #26
0
        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;
        }
コード例 #27
0
ファイル: Form1.cs プロジェクト: computer0316/windows
        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;
        }
コード例 #28
0
ファイル: Form1.cs プロジェクト: computer0316/windows
        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;
        }