Chinaunix首页 | 论坛 | 博客
  • 博客访问: 551523
  • 博文数量: 156
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1183
  • 用 户 组: 普通用户
  • 注册时间: 2013-11-22 11:42
文章分类

全部博文(156)

文章存档

2015年(67)

2014年(89)

分类: C#/.net

2014-12-09 21:46:50


  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;

  9. namespace mou
  10. {
  11.     public partial class Form1 : Form
  12.     {
  13.         Graphics FormCGI;

  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.             FormCGI = this.CreateGraphics();
  18.         }

  19.         private void button1_MouseEnter(object sender, EventArgs e)
  20.         {
  21.             label1.Text = "鼠标进来了";
  22.         }

  23.         private void button1_MouseLeave(object sender, EventArgs e)
  24.         {
  25.             label1.Text = "鼠标离开了";
  26.         }

  27.         private void button1_Click(object sender, EventArgs e)
  28.         {
  29.             label1.Text = "鼠标点击";

  30.             String x, y;
  31.             MouseEventArgs e1 = (MouseEventArgs)e;
  32.             x = e1.X.ToString();
  33.             y = e1.Y.ToString();

  34.             label2.Text = "X坐标:" + x + " Y坐标" + y;
  35.         }

  36.         private void button1_MouseMove(object sender, MouseEventArgs e)
  37.         {
  38.            label2.Text = "鼠标在移动";
  39.         }
  40.     }
  41. }

阅读(1774) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~