隐藏和显示鼠标

Posted on 2019-01-17 22:42  努力成长静待花开  阅读(369)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  API函数ShowCursor  //控制鼠标指针的可视性 

实现代码:

        [DllImport("user32.dll", EntryPoint = "ShowCursor")]
        public extern static bool ShowCursor(bool bShow);
        private void button1_Click(object sender, EventArgs e)
        {
            ShowCursor(false);      //鼠标隐藏
        }
        private void button2_Click(object sender, EventArgs e)
        {
            ShowCursor(true);       //鼠标显示
        }