`

C#程序代码记录一

    博客分类:
  • C#
阅读更多
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _01
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
            //Form1 frm = new Form1();
            //frm.Show();
        }

        private void btnYES_Click(object sender, EventArgs e)
        {
            MessageBox.Show("我也喜欢你");
        }

        private void btnNO_Click(object sender, EventArgs e)
        {
            MessageBox.Show("我还不喜欢你呢");
        }



        private void btnNO_MouseMove(object sender, MouseEventArgs e)
        {
            Random r = new Random();
            int x = r.Next(0, this.Size.Width - this.btnNO.Size.Width);
            int y = r.Next(0, this.ClientSize.Height - this.btnNO.Size.Height);
            Point p = new Point(x, y);
            btnNO.Location = p;
        }
    }
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics