首页 > 学院 > 开发设计 > 正文

抽奖升级版可以经表格数据导入数据库,抽奖设置,补抽

2019-11-14 13:35:12
字体:
来源:转载
供稿:网友
  1 using System;  2 using System.Collections.Generic;  3 using System.ComponentModel;  4 using System.Data;  5 using System.Drawing;  6 using System.Drawing.Imaging;  7 using System.Linq;  8 using System.Text;  9 using System.Threading.Tasks; 10 using System.Windows.Forms; 11 using System.Data.SqlClient; 12 using System.Collections; 13 using System.IO; 14  15 namespace Check_Ticket 16 { 17     public partial class Btn_UpLoadFile : Form 18     { 19         string conn = "server=WIN-OUD59R7EHCH;database=Xtf;uid=sa;pwd=123456"; 20         string sql = ""; 21         int CurNum = 0;//奖项人数 22         int second = 0;//防止二次被抽取 23         Hashtable hashtable2 = new Hashtable();//存储编号 24         Hashtable hashtable1 = new Hashtable();//存储获奖名单 25         Hashtable hashtable = new Hashtable();//避免二次抽奖 26         Dictionary<int, string> dict = new Dictionary<int, string>();//词典存储所有参赛者 27         Random rd = new Random(); 28         int time = 1; 29         Label[] label = new Label[100]; 30         int index = 0;//词典key键值 31         int total = 0;//label个数 32         int num = 0;//获奖总数 33         string s = ""; 34         int End = 0;//抽奖结束 35         public Btn_UpLoadFile() 36         { 37             InitializeComponent(); 38         } 39         PRivate void Form1_Load(object sender, EventArgs e) 40         { 41             dataGridView2.ForeColor = Color.Blue; 42             menu.Visible = false; 43             comboBox1.SelectedIndex = 0; 44             this.timer1.Interval = 10; 45             this.timer3.Interval = 100; 46             this.timer1.Enabled = true; 47             this.WindowState = FormWindowState.Maximized; 48         } 49         private void getNumber(string s) 50         { 51             SqlConnection myconn = new SqlConnection(conn); 52             myconn.Open(); 53             sql = "select *from SumPrize"; 54             SqlDataAdapter da = new SqlDataAdapter(sql, myconn); 55             DataSet ds = new DataSet(); 56             da.Fill(ds); 57             switch (s) 58             { 59                 case "一等奖": 60                     second = 1; 61                     CurNum = Convert.ToInt32(ds.Tables[0].Rows[0]["PrizeNum"].ToString()); 62                     break; 63                 case "二等奖": 64                     second = 2; 65                     CurNum = Convert.ToInt32(ds.Tables[0].Rows[1]["PrizeNum"].ToString()); 66                     break; 67                 case "三等奖": 68                     second = 3; 69                     CurNum = Convert.ToInt32(ds.Tables[0].Rows[2]["PrizeNum"].ToString()); 70                     break; 71                 case "四等奖": 72                     second = 4; 73                     CurNum = Convert.ToInt32(ds.Tables[0].Rows[3]["PrizeNum"].ToString()); 74                     break; 75                 case "五等奖": 76                     second = 5; 77                     CurNum = Convert.ToInt32(ds.Tables[0].Rows[4]["PrizeNum"].ToString()); 78                     break; 79                 case "六等奖": 80                     second = 6; 81                     CurNum = Convert.ToInt32(ds.Tables[0].Rows[5]["PrizeNum"].ToString()); 82                     break; 83                 case "请选择": 84                     CurNum = 0; 85                     break; 86                 default: 87                     break; 88             } 89         } 90         private void button1_Click(object sender, EventArgs e) 91         { 92             SqlConnection myconn = new SqlConnection(conn); 93             myconn.Open(); 94             //未选择抽奖项 95             if (CurNum == 0) 96             { 97                 MessageBox.Show("未设置该奖项或未选择奖项,抽奖没有意义!!!"); 98                 return; 99             }100             //处理已经被抽奖项101 102             if (!hashtable1.ContainsValue(second))103             {104                 comboBox1.Enabled = true;105                 hashtable1.Add(second, second);106             }107             else108             {109                 MessageBox.Show("此奖项已经被抽过,换个奖项吧?");110                 return;111             }112             string prize = comboBox1.Text.ToString();113             string sqlCount = "Select sum(PrizeNum) as num from SumPrize";114             SqlDataAdapter sda = new SqlDataAdapter(sqlCount, myconn);115             DataSet ds = new DataSet();116             sda.Fill(ds);117             //设置有奖总人数118             num = Convert.ToInt32(ds.Tables[0].Rows[0]["num"].ToString());119             for (int i = 0; i < dataGridView1.RowCount-1; i++)120             {121                 dict.Add(index, dataGridView1.Rows[i].Cells["WorkerID"].Value.ToString() + " " + dataGridView1.Rows[i].Cells["Name"].Value.ToString());122                 index++;123             }124            125             myconn.Close();126             timer2.Start();127             clearLabel();128             bornLabel();129             timer1.Enabled = true;130             comboBox1.Enabled = false;131         }132 133         private void button3_Click(object sender, EventArgs e)134         {135             End = 0;136             menu.Text = "";137             hashtable1.Clear();138             clearLabel();139             button1.Enabled = true;140             button5.Enabled = true;141             button2.Enabled = false;142             menu.Visible = false;143             btnAdd.Visible = false;144             tbNum.Visible = false;145             ge.Visible = false;146             addEnd.Visible = false;147             lab1.Text = "中奖名单";148             dataGridView2.Visible = false;149             string sqlChecked = "delete from Checked";150             sql = "select *from Ticket";151             SqlConnection myconn = new SqlConnection(conn);152             myconn.Open();153             SqlDataAdapter sda = new SqlDataAdapter(sql, myconn);154             DataSet ds = new DataSet();155             sda.Fill(ds, "Ticket");156             dataGridView1.DataSource = ds;157             dataGridView1.DataMember = "Ticket";158             SqlCommand mycomm = new SqlCommand(sqlChecked, myconn);159             mycomm.ExecuteNonQuery();160             myconn.Close();161         }162 163         private void button2_Click(object sender, EventArgs e)164         {165             menu.Visible = false;166             clearLabel();167             sql = "select WorkerIDAndName,Prize from Checked order by PrizeID";168             SqlConnection myconn = new SqlConnection(conn);169             myconn.Open();170             SqlDataAdapter sda = new SqlDataAdapter(sql, myconn);171             DataSet ds1 = new DataSet();172             sda.Fill(ds1, "Checked");173             dataGridView2.DataSource = ds1;174             dataGridView2.DataMember = "Checked";175             dataGridView2.Visible = true;176             menu.Text += "恭喜:/n";177             for(int i=0;i<dataGridView2.RowCount-1;i++)178             {179                 menu.Text += dataGridView2.Rows[i].Cells["WorkerIDAndName"].Value.ToString() +"  获得"+ dataGridView2.Rows[i].Cells["Prize"].Value.ToString() + "/n";180             }181             menu.Visible = true;182             timer3.Start();183             myconn.Close();184         }185 186         private void button4_Click(object sender, EventArgs e)187         {188             new SetPeople().ShowDialog();189         }190 191         private void comboBox1_SelectedValueChanged(object sender, EventArgs e)192         {193             getNumber(comboBox1.Text.ToString());194         }195 196         private void timer1_Tick(object sender, EventArgs e)197         {198             lab1.Left = lab1.Left - 6;199             if (lab1.Right < 0)200             {201                 lab1.Left = this.Width;202             }203         }204         //创建labels205         private void bornLabel()206         {207             int i = 0;208             for (i = 0; i < CurNum; i++)209             {210                 label[i] = new Label();211                 label[i].ForeColor = Color.Blue;212                 label[i].Location = new System.Drawing.Point(350, 170 + (i * 50));213                 label[i].Size = new System.Drawing.Size(320, 40);214                 label[i].BackColor = Color.Transparent;215                 label[i].Anchor = (AnchorStyles.Top);216                 label[i].Font = new System.Drawing.Font("SimSun", 20, FontStyle.Bold);217                 this.Controls.Add(label[i]);218             }219             total = i;220         }221         //清除labels222         private void clearLabel()223         {224             for (int i = 0; i < total; i++)225             {226                 this.Controls.Remove(label[i]);227             }228         }229         private void timer2_Tick(object sender, EventArgs e)230         {231             hashtable.Clear();232             hashtable2.Clear();233             SqlConnection con = new SqlConnection(conn);234             string sql = "select count(*) from Ticket";235             SqlCommand com = new SqlCommand(sql, con);236             con.Open();237             int emcount = Convert.ToInt32(com.ExecuteScalar());238             con.Close();239 240             timer2.Enabled = true;241 242             timer2.Interval = time;243             int i;244             for (i = 0; i < CurNum; i++)245             {246                 int random = Convert.ToInt32(rd.Next(0, emcount));247                 if (dataGridView1.Rows[random].Cells["Checked"].Value.ToString().Trim()=="1" 248                     && !hashtable.ContainsValue(dict[random]))249                 {250                     hashtable2.Add(random,random);251                     hashtable.Add(dict[random], dict[random]);252                     label[i].Text = dict[random];253                 }254                 else255                 {256                     i--;257                 }258 259             }260         }261 262         private void button5_Click(object sender, EventArgs e)263         {264             comboBox1.Enabled = true;265             SqlConnection con = new SqlConnection(conn);266             con.Open();267             string sql = "";268             s = "";269             timer2.Stop();270             foreach (DictionaryEntry de in hashtable)271             {272                 sql = string.Format("insert into Checked(WorkerIDAndName,Prize,PrizeID) values('{0}','{1}','{2}')", de.Value.ToString(), comboBox1.Text.ToString(),second.ToString());273                 SqlCommand com = new SqlCommand(sql, con);274                 com.ExecuteNonQuery(); 275                 s += de.Value.ToString() +"   "; 276             }277             foreach (DictionaryEntry de in hashtable2)278             {279                 dataGridView1.Rows[Convert.ToInt32(de.Key)].Cells["Checked"].Value = "0";280             }281             lab1.Text = "恭喜: " + s + "获得" + comboBox1.Text.ToString();282             //判断抽奖结束283             End = End + CurNum;284             if (End == num)285             {286                 button1.Enabled = false;287                 //button5.Enabled = false;288                 button2.Enabled = true;289                 if (MessageBox.Show("抽奖结束,是否进行补抽,点击确定进行补抽,取消结束此次抽奖!", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)290                 {291                     btnAdd.Visible = true;292                     tbNum.Visible = true;293                     ge.Visible = true;294                     addEnd.Visible = true;295                 }296             }297             298         }299 300         private void timer3_Tick(object sender, EventArgs e)301         {302             menu.Top = menu.Top - 6 ;303             if (menu.Bottom < 0)304             {305                 menu.Top = this.Height-600;306             }307         }308 309         private void 关闭窗口ToolStripMenuItem_Click(object sender, EventArgs e)310         {311             this.Close();312         }313 314         private void btnAdd_Click(object sender, EventArgs e)315         {316             CurNum = Convert.ToInt32(tbNum.Text.ToString());317             if (CurNum == 0)318             {319                 MessageBox.Show("请输入补抽个数!!!", "温馨提示");320                 return;321             }322             End = End + CurNum;323             if (End > Convert.ToInt32(dataGridView1.RowCount))324             {325                 button5.Enabled = false;326                 MessageBox.Show("抽奖超过参与人数无法进行补抽!","温馨提示");327                 return;328             }329             timer2.Start();330             clearLabel();331             bornLabel();332         }333 334         private void addEnd_Click(object sender, EventArgs e)335         {336             btnAdd.Visible = false;337             addEnd.Visible = false;338             tbNum.Visible = false;339             ge.Visible = false;340             menu.Visible = false;341             clearLabel();342             sql = "select WorkerIDAndName,Prize from Checked order by PrizeID";343             SqlConnection myconn = new SqlConnection(conn);344             myconn.Open();345             SqlDataAdapter sda = new SqlDataAdapter(sql, myconn);346             DataSet ds1 = new DataSet();347             sda.Fill(ds1, "Checked");348             dataGridView2.DataSource = ds1;349             dataGridView2.DataMember = "Checked";350             menu.Text += "恭喜:/n";351             for (int i = 0; i < dataGridView2.RowCount - 1; i++)352             {353                 menu.Text += dataGridView2.Rows[i].Cells["WorkerIDAndName"].Value.ToString() + "  获得" + dataGridView2.Rows[i].Cells["Prize"].Value.ToString() + "/n";354             }355             menu.Visible = true;356             timer3.Start();357             myconn.Close();358         }359 360         //先导入到dataSet361         public DataSet getXSLData(string filepath)362         {363             string strCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath + ";Extended Properties=/"Excel 12.0;HDR=YES;/"";364             System.Data.OleDb.OleDbConnection Conn = new System.Data.OleDb.OleDbConnection(strCon);365             string strCom = "SELECT * FROM [Sheet1$]";366             Conn.Open();367             System.Data.OleDb.OleDbDataAdapter myCommand = new System.Data.OleDb.OleDbDataAdapter(strCom, Conn);368             DataSet ds = new DataSet();369             myCommand.Fill(ds, "[Sheet1$]");370             Conn.Close();371             return ds;372         }373 374         public static int errorcount = 0;//记录错误信息条数375         public static int insertcount = 0;//记录插入成功条数376         public static int updatecount = 0;//记录更新信息条数377 378         public bool ImportXSL(string home)379         {380             try381             {382                 DataSet ds = new DataSet();383                 //取得数据集384                 //调用上面的函数385                 ds = getXSLData(@home);386 387                 SqlConnection con = new SqlConnection(conn);388                 con.Open();389                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)390                 {391                     string WorkerID = ds.Tables[0].Rows[i][1].ToString();392                     string Name = ds.Tables[0].Rows[i][2].ToString();393                     string Checked = ds.Tables[0].Rows[i][3].ToString();394 395                     if (WorkerID != "" && Name != "")396                     {397                         string sq = string.Format("select * from Ticket where WorkerID='{0}' and Name='{1}'", WorkerID, Name);398                         SqlCommand selectcom = new SqlCommand(sq, con);399                         int count = Convert.ToInt32(selectcom.ExecuteScalar());400                         if (count > 0)401                         {402                             updatecount++;403                         }404                         else405                         {406                             string s = string.Format("insert into Ticket(WorkerID,Name,Checked) values('{0}','{1}','{2}')", WorkerID, Name,Checked);407                             SqlCommand insertcom = new SqlCommand(s, con);408                             int result = insertcom.ExecuteNonQuery();409                             insertcount++;410                         }411                     }412                 }413                 if (updatecount + insertcount == ds.Tables[0].Rows.Count)414                 {415                     return true;416                 }417                 else418                 {419                     return false;420                 }421             }422             catch (Exception e)423             {424                 return false;425             }426         }427         //导入excle428         private void button6_Click(object sender, EventArgs e)429         {430             OpenFileDialog ofd = new OpenFileDialog();431             ofd.Filter = "Microsoft Excel files(*.xls)|*.xls;*.xlsx";//过滤一下,只要表格格式的432             ofd.RestoreDirectory = true;433             ofd.FilterIndex = 1;434             ofd.AddExtension = true;435             ofd.CheckFileExists = true;436             ofd.CheckPathExists = true;437             ofd.ShowHelp = true;//是否显示帮助按钮438             if (ofd.ShowDialog() == DialogResult.OK)439             {440                 this.textBox1.Text = ofd.FileName;441             }   442         }443         //导入excle表格444         private void button7_Click(object sender, EventArgs e)445         {446             SqlConnection con = new SqlConnection(conn);447             con.Open();448             //清空主键信息,标识自增从1开始449             string sqlstr = "truncate table Ticket";450             SqlCommand comm = new SqlCommand(sqlstr,con);451             comm.ExecuteNonQuery();452             con.Close();453             if (textBox1.Text == "")454             {455                 MessageBox.Show("请选择一张表格!!!", "温馨提示");456                 return;457             }  458             if (ImportXSL(textBox1.Text.ToString()))459             {460                 MessageBox.Show(insertcount + "条数据导入成功!" + updatecount + "条数据重复!");461             }462             textBox1.Text = "";463         }
  1 namespace Check_Ticket  2 {  3     partial class Btn_UpLoadFile  4     {  5         /// <summary>  6         /// 必需的设计器变量。  7         /// </summary>  8         private System.ComponentModel.IContainer components = null;  9  10         /// <summary> 11         /// 清理所有正在使用的资源。 12         /// </summary> 13         /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> 14         protected override void Dispose(bool disposing) 15         { 16             if (disposing && (components != null)) 17             { 18                 components.Dispose(); 19             } 20             base.Dispose(disposing); 21         } 22  23         #region Windows 窗体设计器生成的代码 24  25         /// <summary> 26         /// 设计器支持所需的方法 - 不要 27         /// 使用代码编辑器修改此方法的内容。 28         /// </summary> 29         private void InitializeComponent() 30         { 31             this.components = new System.ComponentModel.Container(); 32             this.lab2 = new System.Windows.Forms.Label(); 33             this.comboBox1 = new System.Windows.Forms.ComboBox(); 34             this.button1 = new System.Windows.Forms.Button(); 35             this.dataGridView1 = new System.Windows.Forms.DataGridView(); 36             this.button2 = new System.Windows.Forms.Button(); 37             this.button3 = new System.Windows.Forms.Button(); 38             this.dataGridView2 = new System.Windows.Forms.DataGridView(); 39             this.button4 = new System.Windows.Forms.Button(); 40             this.lab1 = new System.Windows.Forms.Label(); 41             this.timer1 = new System.Windows.Forms.Timer(this.components); 42             this.timer2 = new System.Windows.Forms.Timer(this.components); 43             this.button5 = new System.Windows.Forms.Button(); 44             this.lab = new System.Windows.Forms.Label(); 45             this.timer3 = new System.Windows.Forms.Timer(this.components); 46             this.menu = new System.Windows.Forms.Label(); 47             this.menuStrip1 = new System.Windows.Forms.MenuStrip(); 48             this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 49             this.附加功能ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50             this.label1 = new System.Windows.Forms.Label(); 51             this.btnAdd = new System.Windows.Forms.Button(); 52             this.tbNum = new System.Windows.Forms.TextBox(); 53             this.ge = new System.Windows.Forms.Label(); 54             this.补抽ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 55             this.addEnd = new System.Windows.Forms.Button(); 56             this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); 57             this.button6 = new System.Windows.Forms.Button(); 58             this.textBox1 = new System.Windows.Forms.TextBox(); 59             this.button7 = new System.Windows.Forms.Button(); 60             ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); 61             ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); 62             this.menuStrip1.SuspendLayout(); 63             this.SuspendLayout(); 64             //  65             // lab2 66             //  67             this.lab2.AutoSize = true; 68             this.lab2.BackColor = System.Drawing.Color.Blue; 69             this.lab2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 70             this.lab2.ForeColor = System.Drawing.Color.Red; 71             this.lab2.Location = new System.Drawing.Point(959, 323); 72             this.lab2.Name = "lab2"; 73             this.lab2.Size = new System.Drawing.Size(69, 19); 74             this.lab2.TabIndex = 2; 75             this.lab2.Text = "奖项名称:"; 76             //  77             // comboBox1 78             //  79             this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 80             this.comboBox1.ForeColor = System.Drawing.Color.Red; 81             this.comboBox1.FormattingEnabled = true; 82             this.comboBox1.Items.AddRange(new object[] { 83             "请选择", 84             "一等奖", 85             "二等奖", 86             "三等奖", 87             "四等奖", 88             "五等奖", 89             "六等奖"}); 90             this.comboBox1.Location = new System.Drawing.Point(1047, 322); 91             this.comboBox1.Name = "comboBox1"; 92             this.comboBox1.Size = new System.Drawing.Size(140, 20); 93             this.comboBox1.TabIndex = 3; 94             this.comboBox1.SelectedValueChanged += new System.EventHandler(this.comboBox1_SelectedValueChanged); 95             //  96             // button1 97             //  98             this.button1.Enabled = false; 99             this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));100             this.button1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));101             this.button1.Location = new System.Drawing.Point(944, 402);102             this.button1.Name = "button1";103             this.button1.Size = new System.Drawing.Size(107, 23);104             this.button1.TabIndex = 4;105             this.button1.Text = "开始抽奖";106             this.button1.UseVisualStyleBackColor = true;107             this.button1.Click += new System.EventHandler(this.button1_Click);108             // 109             // dataGridView1110             // 111             this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;112             this.dataGridView1.Location = new System.Drawing.Point(717, 486);113             this.dataGridView1.Name = "dataGridView1";114             this.dataGridView1.RowTemplate.Height = 23;115             this.dataGridView1.Size = new System.Drawing.Size(737, 199);116             this.dataGridView1.TabIndex = 5;117             this.dataGridView1.Visible = false;118             // 119             // button2120             // 121             this.button2.Enabled = false;122             this.button2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));123             this.button2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));124             this.button2.Location = new System.Drawing.Point(1086, 401);125             this.button2.Name = "button2";126             this.button2.Size = new System.Drawing.Size(101, 23);127             this.button2.TabIndex = 6;128             this.button2.Text = "查看获奖名单";129             this.button2.UseVisualStyleBackColor = true;130             this.button2.Click += new System.EventHandler(this.button2_Click);131             // 132             // button3133             // 134             this.button3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));135             this.button3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));136             this.button3.Location = new System.Drawing.Point(818, 401);137             this.button3.Name = "button3";138             this.button3.Size = new System.Drawing.Size(87, 23);139             this.button3.TabIndex = 7;140             this.button3.Text = "人员加载";141             this.button3.UseVisualStyleBackColor = true;142             this.button3.Click += new System.EventHandler(this.button3_Click);143             // 144             // dataGridView2145             // 146             this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;147             this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;148             this.dataGridView2.GridColor = System.Drawing.Color.Black;149             this.dataGridView2.Location = new System.Drawing.Point(963, 486);150             this.dataGridView2.Name = "dataGridView2";151             this.dataGridView2.RowHeadersVisible = false;152             this.dataGridView2.RowTemplate.Height = 23;153             this.dataGridView2.Size = new System.Drawing.Size(203, 199);154             this.dataGridView2.TabIndex = 8;155             this.dataGridView2.Visible = false;156             // 157             // button4158             // 159             this.button4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));160             this.button4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));161             this.button4.Location = new System.Drawing.Point(1223, 401);162             this.button4.Name = "button4";163             this.button4.Size = new System.Drawing.Size(156, 23);164             this.button4.TabIndex = 9;165             this.button4.Text = "设置奖项对应人数";166             this.button4.UseVisualStyleBackColor = true;167             this.button4.Click += new System.EventHandler(this.button4_Click);168             // 169             // lab1170             // 171             this.lab1.AutoSize = true;172             this.lab1.BackColor = System.Drawing.Color.Transparent;173             this.lab1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));174             this.lab1.ForeColor = System.Drawing.Color.Blue;175             this.lab1.Location = new System.Drawing.Point(1011, 830);176             this.lab1.Name = "lab1";177             this.lab1.Size = new System.Drawing.Size(106, 24);178             this.lab1.TabIndex = 10;179             this.lab1.Text = "获奖名单";180             // 181             // timer1182             // 183             this.timer1.Tick += new System.EventHandler(this.timer1_Tick);184             // 185             // timer2186             // 187             this.timer2.Tick += new System.EventHandler(this.timer2_Tick);188             // 189             // button5190             // 191             this.button5.Enabled = false;192             this.button5.ForeColor = System.Drawing.Color.Red;193             this.button5.Location = new System.Drawing.Point(944, 431);194             this.button5.Name = "button5";195             this.button5.Size = new System.Drawing.Size(107, 23);196             this.button5.TabIndex = 11;197             this.button5.Text = "停止抽奖";198             this.button5.UseVisualStyleBackColor = true;199             this.button5.Click += new System.EventHandler(this.button5_Click);200             // 201             // lab202             // 203             this.lab.Anchor = System.Windows.Forms.AnchorStyles.Top;204             this.lab.AutoSize = true;205             this.lab.BackColor = System.Drawing.Color.Transparent;206             this.lab.Font = new System.Drawing.Font("华文新魏", 42F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));207             this.lab.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));208             this.lab.Location = new System.Drawing.Point(753, 31);209             this.lab.Name = "lab";210             this.lab.Size = new System.Drawing.Size(595, 57);211             this.lab.TabIndex = 12;212             this.lab.Text = "善林商务年会抽奖活动";213             // 214             // timer3215             // 216             this.timer3.Tick += new System.EventHandler(this.timer3_Tick);217             // 218             // menu219             // 220             this.menu.AutoSize = true;221             this.menu.BackColor = System.Drawing.Color.Transparent;222             this.menu.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));223             this.menu.ForeColor = System.Drawing.Color.Blue;224             this.menu.Location = new System.Drawing.Point(269, 573);225             this.menu.Name = "menu";226             this.menu.Size = new System.Drawing.Size(0, 24);227             this.menu.TabIndex = 13;228             // 229             // menuStrip1230             // 231             this.menuStrip1.BackColor = System.Drawing.Color.Transparent;232             this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {233             this.ToolStripMenuItem,234             this.附加功能ToolStripMenuItem});235             this.menuStrip1.Location = new System.Drawing.Point(0, 0);236             this.menuStrip1.Name = "menuStrip1";237             this.menuStrip1.Size = new System.Drawing.Size(1920, 25);238             this.menuStrip1.TabIndex = 14;239             this.menuStrip1.Text = "menuStrip1";240             // 241             // ToolStripMenuItem242             // 243             this.ToolStripMenuItem.BackColor = System.Drawing.Color.Transparent;244             this.ToolStripMenuItem.ForeColor = System.Drawing.Color.Blue;245             this.ToolStripMenuItem.Name = "ToolStripMenuItem";246             this.ToolStripMenuItem.Size = new System.Drawing.Size(68, 21);247             this.ToolStripMenuItem.Text = "关闭窗口";248             this.ToolStripMenuItem.Click += new System.EventHandler(this.关闭窗口ToolStripMenuItem_Click);249             // 250             // 附加功能ToolStripMenuItem251             // 252             this.附加功能ToolStripMenuItem.Name = "附加功能ToolStripMenuItem";253             this.附加功能ToolStripMenuItem.Size = new System.Drawing.Size(12, 21);254             // 255             // label1256             // 257             this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top;258             this.label1.AutoSize = true;259             this.label1.ForeColor = System.Drawing.Color.Yellow;260             this.label1.Location = new System.Drawing.Point(747, 98);261             this.label1.Name = "label1";262             this.label1.Size = new System.Drawing.Size(614, 12);263             this.label1.TabIndex = 15;264             this.label1.Text = "---------------------------------------------------------------------------------" +265     "------";266             // 267             // btnAdd268             // 269             this.btnAdd.ForeColor = System.Drawing.Color.Indigo;270             this.btnAdd.Location = new System.Drawing.Point(1086, 431);271             this.btnAdd.Name = "btnAdd";272             this.btnAdd.Size = new System.Drawing.Size(101, 23);273             this.btnAdd.TabIndex = 16;274             this.btnAdd.Text = "补抽";275             this.btnAdd.UseVisualStyleBackColor = true;276             this.btnAdd.Visible = false;277             this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);278             // 279             // tbNum280             // 281             this.tbNum.Location = new System.Drawing.Point(1223, 431);282             this.tbNum.Name = "tbNum";283             this.tbNum.Size = new System.Drawing.Size(125, 21);284             this.tbNum.TabIndex = 17;285             this.tbNum.Text = "0";286             this.tbNum.Visible = false;287             // 288             // ge289             // 290             this.ge.AutoSize = true;291             this.ge.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));292             this.ge.Location = new System.Drawing.Point(1357, 438);293             this.ge.Name = "ge";294             this.ge.Size = new System.Drawing.Size(22, 14);295             this.ge.TabIndex = 18;296             this.ge.Text = "";297             this.ge.Visible = false;298             // 299             // 补抽ToolStripMenuItem300             // 301             this.补抽ToolStripMenuItem.Name = "补抽ToolStripMenuItem";302             this.补抽ToolStripMenuItem.Size = new System.Drawing.Size(32, 19);303             // 304             // addEnd305             // 306             this.addEnd.Location = new System.Drawing.Point(818, 431);307             this.addEnd.Name = "addEnd";308             this.addEnd.Size = new System.Drawing.Size(87, 23);309             this.addEnd.TabIndex = 19;310             this.addEnd.Text = "补抽结束";311             this.addEnd.UseVisualStyleBackColor = true;312             this.addEnd.Visible = false;313             this.addEnd.Click += new System.EventHandler(this.addEnd_Click);314             // 315             // openFileDialog1316             // 317             this.openFileDialog1.FileName = "openFileDialog1";318             // 319             // button6320             // 321             this.button6.Location = new System.Drawing.Point(1086, 371);322             this.button6.Name = "button6";323             this.button6.Size = new System.Drawing.Size(107, 23);324             this.button6.TabIndex = 20;325             this.button6.Text = "选择文件";326             this.button6.UseVisualStyleBackColor = true;327             this.button6.Click += new System.EventHandler(this.button6_Click);328             // 329             // textBox1330             // 331             this.textBox1.Location = new System.Drawing.Point(818, 371);332             this.textBox1.Name = "textBox1";333             this.textBox1.Size = new System.Drawing.Size(233, 21);334             this.textBox1.TabIndex = 21;335             // 336             // button7337             // 338             this.button7.Location = new System.Drawing.Point(1223, 371);339             this.button7.Name = "button7";340             this.button7.Size = new System.Drawing.Size(156, 23);341             this.button7.TabIndex = 22;342             this.button7.Text = "上传文件";343             this.button7.UseVisualStyleBackColor = true;344             this.button7.Click += new System.EventHandler(this.button7_Click);345             // 346             // Btn_UpLoadFile347             // 348             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);349             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;350             this.BackColor = System.Drawing.Color.Red;351             this.ClientSize = new System.Drawing.Size(1920, 1038);352             this.Controls.Add(this.button7);353             this.Controls.Add(this.textBox1);354             this.Controls.Add(this.button6);355             this.Controls.Add(this.addEnd);356             this.Controls.Add(this.ge);357             this.Controls.Add(this.tbNum);358             this.Controls.Add(this.btnAdd);359             this.Controls.Add(this.label1);360             this.Controls.Add(this.menu);361             this.Controls.Add(this.lab);362             this.Controls.Add(this.button5);363             this.Controls.Add(this.lab1);364             this.Controls.Add(this.button4);365             this.Controls.Add(this.dataGridView2);366             this.Controls.Add(this.button3);367             this.Controls.Add(this.button2);368             this.Controls.Add(this.comboBox1);369             this.Controls.Add(this.dataGridView1);370             this.Controls.Add(this.button1);371             this.Controls.Add(this.lab2);372             this.Controls.Add(this.menuStrip1);373             this.DoubleBuffered = true;374             this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));375             this.ForeColor = System.Drawing.Color.Purple;376             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;377             this.MainMenuStrip = this.menuStrip1;378             this.MaximumSize = new System.Drawing.Size(2237, 1080);379             this.MinimumSize = new System.Drawing.Size(1918, 1038);380             this.Name = "Btn_UpLoadFile";381             this.ShowIcon = false;382             this.Text = "抽奖界面";383             this.Load += new System.EventHandler(this.Form1_Load);384             ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();385             ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();386             this.menuStrip1.ResumeLayout(false);387             this.menuStrip1.PerformLayout();388             this.ResumeLayout(false);389             this.PerformLayout();390 391         }392 393         #endregion394 395         private System.Windows.Forms.Label lab2;396         private System.Windows.Forms.ComboBox comboBox1;397         private System.Windows.Forms.Button button1;398         private System.Windows.Forms.DataGridView dataGridView1;399         private System.Windows.Forms.Button button2;400         private System.Windows.Forms.Button button3;401         private System.Windows.Forms.DataGridView dataGridView2;402         private System.Windows.Forms.Button button4;403         private System.Windows.Forms.Label lab1;404         private System.Windows.Forms.Timer timer1;405         private System.Windows.Forms.Timer timer2;406         private System.Windows.Forms.Button button5;407         private System.Windows.Forms.Label lab;408         private System.Windows.Forms.Timer timer3;409         private System.Windows.Forms.Label menu;410         private System.Windows.Forms.MenuStrip menuStrip1;411         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;412         private System.Windows.Forms.Label label1;413         private System.Windows.Forms.Button btnAdd;414         private System.Windows.Forms.TextBox tbNum;415         private System.Windows.Forms.Label ge;416         private System.Windows.Forms.ToolStripMenuItem 附加功能ToolStripMenuItem;417         private System.Windows.Forms.ToolStripMenuItem 补抽ToolStripMenuItem;418         private System.Windows.Forms.Button addEnd;419         private System.Windows.Forms.OpenFileDialog openFileDialog1;420         private System.Windows.Forms.Button button6;421         private System.Windows.Forms.TextBox textBox1;422         private System.Windows.Forms.Button button7;423     }424 }

 

464     }465 }

数据库设计

界面


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表