关于判断是否鼠标移动的问题 最近做了一个简单的播放器,在显示图像的panel上放了一个透明的pic,想要在全屏显示时过五秒让鼠标指针消失,但是貌似只要pic的大小发生变化他的MouseMove事件就会一直执行,请问下还有什么方法可以判断鼠标是否移动,或者是怎么解决MouseMove一直执行的问题。谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //添加pic1的大小改变事件 void pic1_SizeChanged(object sender, EventArgs e) { if(this.WindowState == FormWindowState.Maximized) { this.pic1.MouseMove -= ..;//去掉移动事件 } else { this.pic1.MouseMove += ..;//添加移动事件 } } 其实我主要是想让它全屏后才有那事件 不全屏的时候倒是没关系 我发现自己写的那个透明pic好像也有问题 因为不管最大还是普通 mousemove都是一直在执行下面是那个透明pic的代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Data;using System.Text;using System.Windows.Forms;namespace _KZone{ public partial class tspControl : UserControl { public tspControl() { InitializeComponent(); SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); this.BackColor = Color.Transparent; } private Image img; public Image Image { get { return img; } set { img = value; } } //protected override void OnLocationChanged(EventArgs e) //{ // //base.OnLocationChanged(e); // Visible = false; // Visible = true; //} protected override CreateParams CreateParams { get { //return base.CreateParams; CreateParams cp = base.CreateParams; cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARENT return cp; } } //protected override void OnPaint(PaintEventArgs pe) //{ // if (img != null) // { // base.OnPaint(pe); // pe.Graphics.DrawImage(img, 0, 0); // } // else // { // return; // } //} }} timer 控件 或者 mousehover 事件 size change 还会引发 mousemove 事件? 你要“全屏显示时过五秒让鼠标指针消失”关MouseMove事件什么事儿... 貌似是我那个控件写的有问题 它会一直执行mousemove http://wenwen.soso.com/z/q168709862.htm 求教:字符串处理 谁知道Infragistics NetAdvantage中wingrid要怎样显示行号? 一条sql语句的使用问题 求winform Tab键换成Enter键的代码 新手请教一个索引器问题,望高手解答. combobox控件的一个疑惑问题,有兴趣的朋友可以进来看看。 请高手帮忙解决coalesys菜单项被遮挡的问题 如何在运行时的界面上拖动一个控件? datagrid问题 一个小问题? gps定位显示的软件用c#怎么开发,地图用什么?有做过的没 关于C#取得Ip数据包后数据分析请教
//添加pic1的大小改变事件
void pic1_SizeChanged(object sender, EventArgs e)
{
if(this.WindowState == FormWindowState.Maximized)
{
this.pic1.MouseMove -= ..;//去掉移动事件
}
else
{
this.pic1.MouseMove += ..;//添加移动事件
}
}
下面是那个透明pic的代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;namespace _KZone
{
public partial class tspControl : UserControl
{
public tspControl()
{
InitializeComponent();
SetStyle(ControlStyles.SupportsTransparentBackColor
| ControlStyles.UserPaint
| ControlStyles.AllPaintingInWmPaint
| ControlStyles.Opaque, true);
this.BackColor = Color.Transparent;
} private Image img;
public Image Image
{
get
{
return img;
}
set
{
img = value;
}
} //protected override void OnLocationChanged(EventArgs e)
//{
// //base.OnLocationChanged(e);
// Visible = false;
// Visible = true;
//} protected override CreateParams CreateParams
{
get
{
//return base.CreateParams;
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARENT
return cp;
}
}
//protected override void OnPaint(PaintEventArgs pe)
//{
// if (img != null)
// {
// base.OnPaint(pe);
// pe.Graphics.DrawImage(img, 0, 0);
// }
// else
// {
// return;
// }
//}
}
}
size change 还会引发 mousemove 事件?