如何让鼠标指针变为黑色半透明
鼠标移到客户区时,即变为黑色半透明。。。
[解决办法]
自己做一个鼠标图片,通过样式文件更改鼠标图标
[解决办法]
public void SetCursor(Bitmap cursor, Point hotPoint)
{
int hotX = hotPoint.X;
int hotY = hotPoint.Y;
Bitmap myNewCursor = new Bitmap(cursor.Width * 2 - hotX, cursor.Height * 2 - hotY);
Graphics g = Graphics.FromImage(myNewCursor);
g.Clear(Color.FromArgb(0, 0, 0, 0));
g.DrawImage(cursor, cursor.Width - hotX, cursor.Height - hotY, cursor.Width,
cursor.Height);
this.Cursor = new Cursor(myNewCursor.GetHicon());
g.Dispose();
myNewCursor.Dispose();
}
在你想要改变鼠标样式的事件里头使用这个方法就行了,如:
private void Form1_Load(object sender, EventArgs e)
{
Bitmap a=(Bitmap)Bitmap.FromFile("myCur.png");
SetCursor(a, new Point(0, 0));
}
[解决办法]
使用ShowCursor API,直接隐藏鼠标,然后画个黑色半透明图形跟住