Mzg121584668
/// <summary>
/// 改变鼠标指针
/// </summary>
/// <param name="cursor"></param>
/// <param name="hotPoint"></param>
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 - 21, cursor.Width, cursor.Height);
    this.Cursor = new Cursor(myNewCursor.GetHicon());
    g.Dispose();
    myNewCursor.Dispose();
}

private void pic_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left)
    {
        Bitmap bm = (Bitmap)Bitmap.FromFile("钢笔2_03.png");
        SetCursor(bm, new Point(0, 0));
    }
}

private void pic_MouseUp(object sender, MouseEventArgs e)
{
    Cursor = Cursors.Default;
}

 

分类:

技术点:

相关文章:

  • 2021-09-06
  • 2021-11-01
  • 2021-11-11
  • 2021-11-11
  • 2021-11-14
  • 2021-12-06
  • 2021-11-11
猜你喜欢
  • 2021-11-01
  • 2021-10-16
  • 2021-11-04
  • 2021-11-14
  • 2021-09-11
  • 2021-11-14
  • 2021-12-16
相关资源
相似解决方案