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);
}
}
}