The automatic start multimedia CD technology is widely used. Most of the current CDs use these technologies to reduce the time when users click to enter.
027 automatic multimedia CD Program
It is very easy to automatically run the CD. When you open the CD, you will find several special files in the CD, such as "autorun.exe" and "run. ico "and" autorun. inf ", where" autorun.exe "is the executable file executed during automatic playback of the CD," run. ico "is the disc icon," autorun. inf is an INI file. As long as these files are included in the CD, the CD will automatically run when it is placed into the optical drive.
1. Create a project. The default form is Form1. Add the Button control to the Form1 form.
2. Run the program and name the executable file "autorun.exe", which is the file opened during automatic playback of the CD.
3. Select an icon named "run. ico", which will be displayed when the drive is read.
4. When you burn a CD, you can also burn the above three files "autorun.exe", "run. ico", and "autorun. inf" to the CD.
Namespace _ 027_AutoRun {public partial class Form1: Form {public Form1 () {InitializeComponent ();} private void Form1_Load (object sender, EventArgs e) {// defines an object StreamWriter sw = new StreamWriter ("AutoRun. inf ", false); sw. writeLine ("[autorun]"); sw. writeLine ("OPEN = AUTORUN. EXE "); sw. writeLine ("ICON = run. ICO "); sw. close (); // Close the current StreamWrite object and basic stream }}}
028 Add a virtual keyboard for the touch screen program
In this example, the transparent attributes and string truncation techniques of the Lable control are used, mainly using the Substring method.
1. Create a project. The default form is Form1. Add two Panel controls, one TextBox Control, and multiple Label controls to the Form1 form. Each Label control corresponds to a button on the background image.
2. Add a background image to the Panel control, set the BackColor attribute of the Label control to transparent, and set the AutoSize attribute to False.
Namespace _ 028_TouchKey {public partial class Form1: Form {public Form1 () {InitializeComponent ();} private void Form1_Load (object sender, EventArgs e) {// method for processing the Label event that does not contain event data lbl_0.Click + = new EventHandler (lbl_Click); Updated ++ = new EventHandler (lbl_Click); lbl_2.Click + = new EventHandler (lbl_Click ); listener + = new EventHandler (lbl_Click); lbl_4.Click + = new EventHandler (lbl_Click); listener + = new EventHandler (lbl_Click ); listener + = new EventHandler (lbl_Click); lbl_8.Click + = new EventHandler (lbl_Click); listener + = new EventHandler (lbl_Click ); listener + = new EventHandler (lbl_Click); listener + = new EventHandler (lbl_Click); lbl_T.Click + = new EventHandler (lbl_Click ); listener + = new EventHandler (lbl_Click); listener + = new EventHandler (lbl_Click); lbl_O.Click + = new EventHandler (lbl_Click ); listener + = new EventHandler (lbl_Click); lbl_A.Click + = new EventHandler (lbl_Click); listener + = new EventHandler (lbl_Click ); listener + = new EventHandler (lbl_Click); lbl_G.Click + = new EventHandler (lbl_Click); listener + = new EventHandler (lbl_Click ); listener + = new EventHandler (lbl_Click); lbl_L.Click + = new EventHandler (lbl_Click); listener + = new EventHandler (lbl_Click ); listener + = new EventHandler (lbl_Click); lbl_V.Click + = new EventHandler (lbl_Click); listener + = new EventHandler (lbl_Click ); lbl_M.Click + = new EventHandler (lbl_Click); label44.Click + = new EventHandler (label44_Click);} private void label44_Click (object sender, EventArgs e) {if (textBox1.Text. length> 0) {Label l = (Label) sender; textBox1.Text = textBox1.Text. substring (0, textBox1.Text. length-1); textBox1.SelectionStart = textBox1.Text. length ;}} void lbl_Click (object sender, EventArgs e) {Label l = (Label) sender; // defines a Label variable l textBox1.Text + = l. name. substring (4, 1); // value textBox1.SelectionStart = textBox1.Text for textBox1. length; // set the starting point of the selected text in the text box} private void label1_Click (object sender, EventArgs e) {Close ();}}}