程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> 抽獎升級版 可以經表格數據導入數據庫,抽獎設置,補抽,升級版數據導入

抽獎升級版 可以經表格數據導入數據庫,抽獎設置,補抽,升級版數據導入

編輯:C#入門知識

抽獎升級版 可以經表格數據導入數據庫,抽獎設置,補抽,升級版數據導入


  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             else
108             {
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         //創建labels
205         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         //清除labels
222         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                 else
255                 {
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         //先導入到dataSet
361         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             try
381             {
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                         else
405                         {
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                 else
418                 {
419                     return false;
420                 }
421             }
422             catch (Exception e)
423             {
424                 return false;
425             }
426         }
427         //導入excle
428         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             // dataGridView1
110             // 
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             // button2
120             // 
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             // button3
133             // 
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             // dataGridView2
145             // 
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             // button4
158             // 
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             // lab1
170             // 
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             // timer1
182             // 
183             this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
184             // 
185             // timer2
186             // 
187             this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
188             // 
189             // button5
190             // 
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             // lab
202             // 
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             // timer3
215             // 
216             this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
217             // 
218             // menu
219             // 
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             // menuStrip1
230             // 
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             // ToolStripMenuItem
242             // 
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             // 附加功能ToolStripMenuItem
251             // 
252             this.附加功能ToolStripMenuItem.Name = "附加功能ToolStripMenuItem";
253             this.附加功能ToolStripMenuItem.Size = new System.Drawing.Size(12, 21);
254             // 
255             // label1
256             // 
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             // btnAdd
268             // 
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             // tbNum
280             // 
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             // ge
289             // 
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             // 補抽ToolStripMenuItem
300             // 
301             this.補抽ToolStripMenuItem.Name = "補抽ToolStripMenuItem";
302             this.補抽ToolStripMenuItem.Size = new System.Drawing.Size(32, 19);
303             // 
304             // addEnd
305             // 
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             // openFileDialog1
316             // 
317             this.openFileDialog1.FileName = "openFileDialog1";
318             // 
319             // button6
320             // 
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             // textBox1
330             // 
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             // button7
337             // 
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_UpLoadFile
347             // 
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         #endregion
394 
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 }

數據庫設計

界面

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved