Today is Valentine's Day, cough, men with their male friends, women with their girlfriends happily stroll the street. The inverse of the day will not follow the public, and continue to the C # Small white series of tutorials ~ ~ ~
Really do not have the time to record the tutorial, just look at the document, we all know that the course is a comparison of the cost, I do not want to quickie, it is not responsible for everyone and my own, video can be recorded later, but the software and the source and documentation must be first, after all, the inverse of the day do not like to betray
Don't talk nonsense, start our tutorial bar ~
Software download (. NET 4.0 framework) Http://pan.baidu.com/s/1i3BUVNv "source see below"
First, design drawings:
Second, code Analysis:
(Many people tell me that my code is a color, it looks very painful ...) All right, I'll use the advanced features of the space to show the code later.
Today, we will talk about the most common online programming, call someone else's encapsulated DLL file, and then simply assign a few properties and then call a few methods to achieve the function you want (this easy to use the language module similar)
There are a total of three general direction:
1. Call DLL file to generate two-dimensional code image (core)
Remember to introduce namespaces: using ThoughtWorks.QRCode.Codec; The Qrcodeencoder namespace using System.Drawing; The Bitmap namespace using System.Windows.Forms; The namespace of the Form Bitmap image=null; To store the image qrcodeencoder QR = new Qrcodeencoder (); Instantiating an Object
Qr. Qrcodeencodemode = Qrcodeencoder.encode_mode. BYTE; Store () qr in bytes. Qrcodescale = 5; This sets the size of the QR code 5-250*250 4-200*200 3-150*150 2-100*100 1-50*50
Qr. Qrcodeversion = 8; Version number, 8 is the latest version of try {qr. Qrcodeerrorcorrect = qrcodeencoder.error_correction. M It comes with error correction, and several options are similar to image = Qr. Encode (S, Encoding.UTF8); Store string in UTF-8 (International Code)} catch//This exception handling is placed in the input content too much caused by an array overflow exception {MessageBox.Show ("Pro Ah, you talk too much of it ~ ~ ~ My belly can not fit AH ~ ~"); In fact, when you do not know what this method is, move the mouse over, press F12 can see the parsing of the DLL to write this is lazy, I anti-compilation of the Very egg pain ... I can only understand what he means. Then there's a call to the methods and properties that follow
2, Alternative way tone form (usually show (), my side is not)
The main form of the tone form is inevitably present, it is very conspicuous, is there any special way to invoke it?
The inverse of the day freshman study of the dead did not get out, various search information, various searches ... Later in the recording of C # pseudo-virus when suddenly found in my database such a magical method:
When the main form hits the button: Div. ShowDialog (this); Turning the form into a dialog-mode div is an instantiated object of the subform (Div div=new div ();)
When the subform is loaded: this. Owner.hide (); The form that opens this form hides the setting
Sub-form Close event: Application.exit (); Remember to exit Oh ~ (if you want to continue to show the main form, write this.) Owner.show ();)
3, save the picture inside the PictureBox
The simplest way to teach you:
Find a SaveFileDialog control in the Toolbox first, and then look at the following:
saveFileDialog1.Filter = jpg image (*.jpg) |*.jpg|png image (*.png) |*.png|bmp image ( *.bmp) |*.bmp| all formats (*. *) |*.* "; if (Savefiledialog1.showdialog () == dialogresult.ok) { string folderp = savefiledialog1.filename; Assign the image name entered in your Save dialog box to the string folderp Image img = qrImage.Image; Started to get the image out. ~ img. Save (FOLDERP); //saved, by the way the name also help you to change the ~ }
Third, source code sharing: Http://pan.baidu.com/s/1jGl46kI
IV, video sharing: such as ~~~
This issue recommendation: the Evil . NET reflector 7.0 8.0 , &NB Sp Next issue: Build your own picture viewer