加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

修正光标图像热点

发布时间:2020-12-14 04:26:57 所属栏目:大数据 来源:网络整理
导读:public void SetCursor(Bitmap cursor,Point hotPoint) // 移动自定义光标的图象位置,使他在0 0点起作用 { try { int hotX = hotPoint.X; int hotY = hotPoint.Y; Bitmap myNewCursor = new Bitmap(cursor.Width * 2 - hotX,cursor.Height * 2 - hotY); Gra
        public void SetCursor(Bitmap cursor,Point hotPoint)//移动自定义光标的图象位置,使他在0 0点起作用
        {
            try {
            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.DrawImage(cursor,cursor.Width - hotX,cursor.Height - hotY,cursor.Width,cursor.Height);
            theImage.Cursor = new Cursor(myNewCursor.GetHicon());
            g.Dispose();
            }
            catch(Exception ex)
            { }
        }

?

?
调用方法?
                        Cursor obj = new Cursor(curbmp.GetHicon());
                        SetCursor(curbmp,obj.HotSpot);//目前遇到的自定义光标是在中间位置

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读