您的位置:首页 > 移动开发 > Objective-C

mousemove事件以及MessageBox.show()方法

2012-08-14 14:13 162 查看
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace 课堂1

{

    public partial class frmLove : Form

    {

        public frmLove()

        {

            InitializeComponent();

        }

        private void btnLike_Click(object sender, EventArgs e)

        {

            MessageBox.Show("我也喜欢你!","爱情");

        }

        private void btnNotLike_Click(object sender, EventArgs e)

        {

            DialogResult result = MessageBox.Show("是因为我长得丑吗?", "你为什么不喜欢我?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (result == DialogResult.OK)

            {

                MessageBox.Show("我也讨厌你!", "爱情的悲剧");

            }

            else

            {

                MessageBox.Show("你是喜欢我的吧", "爱情的乐趣");

            }

        }

        private void btnNotLike_MouseMove(object sender, MouseEventArgs e)

        {

            Random r = new Random();

            int i = r.Next(0, this.Location.Y - this.btnNotLike.Height);

            int j = r.Next(0, this.Location.X - this.btnNotLike.Width);

            this.btnNotLike.Location = new Point(i, j);

        }

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  object random class
相关文章推荐