02 button exercises, 02button exercises

Source: Internet
Author: User

02 button exercises, 02button exercises

1 2 3 private void button#click (object sender, EventArgs e) 4 {5 MessageBox. Show ("I like you too! "); 6 // if (this. button1.Text = "like") 7 // {8 // button2.Visible = false; 9 //} 10 11} 12 private void button2_Click (object sender, EventArgs e) 13 {14 MessageBox. show ("I still don't like you! "); 15 // if (this. button2.Text = "dislike") 16 // {17 // button1.Visible = false; 18 //} 19 20 21} 22 23 private void button2_MouseMove (object sender, MouseEventArgs e) 24 {25 // The Button2 cannot move the mouse to 26 Random suiJi = new Random (); 27 int x = suiJi. next (0, this. size. width-this.button2.Size.Width); 28 int y = suiJi. next (0, this. clientSize. height-this.button2.Size.Height); 29 30 Point p = new Point (x, y); 31 button2.Locat Ion = p; 32 33} 34 35 private void Form1_Load (object sender, EventArgs e) 36 {37 MessageBox. Show ("do a test !! "); // Messagebox is a type that will be followed. 38 39} 40 41 private void Form1_FormClosing (object sender, FormClosingEventArgs e) 42 {43 // simple syntax of the form close event 44 DialogResult re = MessageBox. show ("are you sure you want to close", "Ask", MessageBoxButtons. yesNo, MessageBoxIcon. question); 45 if (re = DialogResult. no) 46 {47 e. cancel = true; 48} 49}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.