This thing is actually the simplest thing, a random number a set of a timer control is done. Originally did not want to write this issue, and then a friend told me that he bought a lottery system on the internet spent hundreds of yuan .... Software sent me a anti-compilation ... I was so stunned ... A wretched non-human to this pit a good cheat of human ...
To get to the point, the inverse of the day brought to everyone is the name of the lottery series of small system, in order to universality and simplicity is not written dead directly with a TXT record (in fact, the program can also change the death of some of his content, in the end of this chapter will give you a gadget "c32asm")
Software download (. NET 4.0 framework) http://pan.baidu.com/s/1sjK2rG5 "source See below" (No too much landscaping)
(This is what I used to do in IBM in order to do the work of the (abnormal version), you decompile, I did not add shell)
Http://pan.baidu.com/s/1dDenq6X
First, design drawings:
Second, code Analysis: 1, read the text and write the elements into the collection: The text is a small file, directly read with file, the specific explanation:
defines a set of paradigms: Dictionary<int, string> dic = new Dictionary<int, string> (); if (File.exists (" Dnt.txt ")//determine if the file exists { try { String[] dnt = file.readalllines ("Dnt.txt", encoding.default);//save data in the default encoding format (fix Chinese garbled) int i = 0; foreach (String item &NBSP;IN&NBSP;DNT)//all written to list<t> {&NBSP;&NBSP;&Nbsp; if (!string. IsNullOrEmpty (item. Trim ()))//non-empty can be written in, and the line is not all spaces { dic. ADD (I++, item. Trim ());//The Blank of the head and tail to remove } } } catch { messagebox.show ("Pro, You turn me off and then open again, so I can live happily again ~ "); } } else { &nBsp; file.create ("Dnt.txt"); messagebox.show ("If you want to customize the content, put the data in the current directory Dnt.txt row by line \ n The software will reread the contents of the text every time it opens!") ", " anti-day Friendship reminder "); }
2, randomly display the contents of the text inside:
if (DIC. Count > 0)//First Look at the collection is not empty (default is empty "and the different") {random r = new Random (); int n = r.next (0, DiC. Count); Lbl1. Text = Dic[n]; Lbl1. left = (433-lbl1. Width)/2; Control IT Center alignment (I'm dead here, you change it) "form width-lbl half of width"}
Is there nothing good to say? Hundreds of bucks??!!! The year in the company generally have a lottery link, non-it if you get a this, is not very hanging? I floated past ~ ~ ~
Third, source sharing: http://pan.baidu.com/s/1sjudRUt
Iv. video sharing: etc ~ ~ ~
Recommended: C32asm (very good gadget) next issue: Manually build simplified mutual converters
Small white C # form Series-04. Small System of name series