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);
}
}
}
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);
}
}
}
相关文章推荐
- 安卓学习笔记---Fragmnet使用之add,show,hide,remove以及replace方法
- 跨浏览器 HTML5 postMessage 方法以及 message 事件模拟实现
- VB6 中如何访问C# Dll 中的方法、属性以及事件
- android 按钮点击的两种方法以及长按事件
- [ios]IOS的AppDelegate方法中的事件触发调用 以及 关闭 ios应用程序
- .net 下操作鼠标滚轮的事件 以及换算方法
- jquery mobile的tap()事件以及jQuery事件的delegate()方法
- wp8 在OnBackKeyPress事件中调用MessageBox.Show()崩溃
- dialog参数、方法以及事件
- ExtJS让被遮盖的窗体显示在最前面以及解决Ext.MessageBox提示框被TabPanel覆盖的方法【转】
- C#中的MessageBox的show的各种重载方法使用
- 稳扎稳打Silverlight(32) - 2.0Tip/Trick之MessageBox, Popup, 循环的几种实现方法, 动态变换主题, 本地化(多语言), 响应鼠标双击事件
- VB 生成exe后,动态加载窗体的show事件会出现运行时错误5的解决方法
- 《WF编程》系列之19 - 触发事件与调用方法:服务以及工作流的实现 3.2.3.2服务的实现
- ios的hitTest方法以及不规则区域内触摸事件处理方法
- ViewPager禁止滑动以及它与内层滑动控件水平方向上事件冲突的解决方法
- JS阻止冒泡事件以及默认事件发生的简单方法
- js调用.net后台事件,和后台调用前台等方法以及js调用服务器控件的方法
- JQuery 支持 hide 和 show 事件的方法与分析
- android studio使用ButterKnife 8.0.1报空指针错误以及点击事件无效的解决方法