/* * Created by SharpDevelop. * User: STUDENT * Date: - TopicsExpress



          

/* * Created by SharpDevelop. * User: STUDENT * Date: 18/8/2557 * Time: 11:07 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace Rocket { /// /// Description of MainForm. /// public partial class MainForm : Form { int cnt = 1;// for count the flashes of the bombs. int y1 ;// for pictureBox1. Top; public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); y1 = pictureBox1.Top; // // TODO: Add constructor code after the InitializeComponent() call. // } void MainFormLoad(object sender, EventArgs e) { } void Button1Click(object sender, EventArgs e) { pictureBox1.Left +=10 ; if(pictureBox1.Left > Width ) pictureBox1.Left = -pictureBox1.Width; } void Button2Click(object sender, EventArgs e) { Close(); } void MainFormClick(object sender, EventArgs e) { } void PictureBox1Click(object sender, EventArgs e) { // when pictureBox1 (or rocket) was clicked timer1.Enabled=false; //stop timer1 forหยุด timer1 to stop the movement of the rocket. pictureBox1.Load(@Image/bomb.gif); // loading image bombs, to replace of rocket. int w2 = pictureBox1.Height; //Read the height of the image to calculate for explosive bomb. pictureBox1.Top = y1-w2/2; //Configuration for the explosion Rocket over the center. timer2.Enabled=true; //Assigned to the timer 2 run bomb to blink. } void Timer2Tick(object sender, EventArgs e) { //when timer2 working show a display the hidden images, flashing alternately 10 times the image if( cnt % 2==1) } PictureBox1.Visible=false; }else{ pictureBox1.Visible=true; } cnt++; //cycle count if(cnt--10){ //Check it every 10 rounds to show new rocket. pictureBox1.Load(@images\rocket.gif); // loading image rockets, to replace of bombs. pictureBox1.Top = y1; //Determine the position of the top. pictureBox1.Left= -pictureBox1.Width; //Defined the image to outside the left. pictureBox1.Visible=true; //Define for visualize. timer2.Enabled=false; //stop to timer2. timer1.Enabled=true; //Define to timer1 is working. cnt-o; //Define to the value to start counting.
Posted on: Mon, 18 Aug 2014 05:02:10 +0000

Trending Topics



Recently Viewed Topics




© 2015