Example #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            GlobalNameList = SampleLottery.getWinner();

            switch (GlobalNameList.Count)
            {
            case 1:
                labelNameBig.Visible = true;
                labelNameBig.Text    = GlobalNameList[0];
                break;

            case 2:
                labelName4.Visible = true;
                labelName6.Visible = true;
                labelName4.Text    = GlobalNameList[0];
                labelName6.Text    = GlobalNameList[1];
                break;

            case 5:
                labelName1.Visible = true;
                labelName3.Visible = true;
                labelName5.Visible = true;
                labelName7.Visible = true;
                labelName9.Visible = true;

                labelName1.Text = GlobalNameList[0];
                labelName3.Text = GlobalNameList[1];
                labelName5.Text = GlobalNameList[2];
                labelName7.Text = GlobalNameList[3];
                labelName9.Text = GlobalNameList[4];
                break;

            case 10:
                labelName1.Visible  = true;
                labelName2.Visible  = true;
                labelName3.Visible  = true;
                labelName4.Visible  = true;
                labelName5.Visible  = true;
                labelName6.Visible  = true;
                labelName7.Visible  = true;
                labelName8.Visible  = true;
                labelName9.Visible  = true;
                labelName10.Visible = true;

                labelName1.Text  = GlobalNameList[0];
                labelName2.Text  = GlobalNameList[1];
                labelName3.Text  = GlobalNameList[2];
                labelName4.Text  = GlobalNameList[3];
                labelName5.Text  = GlobalNameList[4];
                labelName6.Text  = GlobalNameList[5];
                labelName7.Text  = GlobalNameList[6];
                labelName8.Text  = GlobalNameList[7];
                labelName9.Text  = GlobalNameList[8];
                labelName10.Text = GlobalNameList[9];
                break;

            case 3:
            case 4:
            case 6:
            case 7:
            case 8:
            case 9:
                try
                {
                    labelName1.Visible  = true;
                    labelName2.Visible  = true;
                    labelName3.Visible  = true;
                    labelName4.Visible  = true;
                    labelName5.Visible  = true;
                    labelName6.Visible  = true;
                    labelName7.Visible  = true;
                    labelName8.Visible  = true;
                    labelName9.Visible  = true;
                    labelName10.Visible = true;

                    labelName1.Text  = GlobalNameList[0];
                    labelName2.Text  = GlobalNameList[1];
                    labelName3.Text  = GlobalNameList[2];
                    labelName4.Text  = GlobalNameList[3];
                    labelName5.Text  = GlobalNameList[4];
                    labelName6.Text  = GlobalNameList[5];
                    labelName7.Text  = GlobalNameList[6];
                    labelName8.Text  = GlobalNameList[7];
                    labelName9.Text  = GlobalNameList[8];
                    labelName10.Text = GlobalNameList[9];
                }
                catch
                {
                    //不处理
                }
                break;


            default:
                try
                {
                    labelName1.Visible  = true;
                    labelName2.Visible  = true;
                    labelName3.Visible  = true;
                    labelName4.Visible  = true;
                    labelName5.Visible  = true;
                    labelName6.Visible  = true;
                    labelName7.Visible  = true;
                    labelName8.Visible  = true;
                    labelName9.Visible  = true;
                    labelName10.Visible = true;

                    labelName1.Font  = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    labelName2.Font  = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    labelName3.Font  = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    labelName4.Font  = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    labelName5.Font  = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    labelName6.Font  = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    labelName7.Font  = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    labelName8.Font  = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    labelName9.Font  = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    labelName10.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));


                    labelName1.Text  = GlobalNameList[0] + "   " + GlobalNameList[1];
                    labelName2.Text  = GlobalNameList[2] + "   " + GlobalNameList[3];
                    labelName3.Text  = GlobalNameList[4] + "   " + GlobalNameList[5];
                    labelName4.Text  = GlobalNameList[6] + "   " + GlobalNameList[7];
                    labelName5.Text  = GlobalNameList[8] + "   " + GlobalNameList[9];
                    labelName6.Text  = GlobalNameList[10] + "   " + GlobalNameList[11];
                    labelName7.Text  = GlobalNameList[12] + "   " + GlobalNameList[13];
                    labelName8.Text  = GlobalNameList[14] + "   " + GlobalNameList[15];
                    labelName9.Text  = GlobalNameList[16] + "   " + GlobalNameList[17];
                    labelName10.Text = GlobalNameList[18] + "   " + GlobalNameList[19];
                }
                catch
                {
                    //不处理
                }

                break;
            }
        }