单击按钮时如何制作自定义光标

时间:2017-03-08 17:51:36

标签: c# winforms cursor

如何在单击将投射等待光标的按钮时自定义

enter image description here

就像当你将鼠标悬停在鼠标上时,例如在后退按钮中,它将是默认光标或手部物体,当我点击它时将显示如下

enter image description here

提前谢谢

2 个答案:

答案 0 :(得分:0)

private void pictureBox1_MouseUp(object sender, EventArgs e)
{
    pictureBox1.Cursor = Cursors.WaitCursor;
}

答案 1 :(得分:0)

我设法回答我的问题

private void btnLOGIN_Click(object sender, EventArgs e)
    { 
        try
        {

            Cursor.Current = Cursors.WaitCursor;
            Application.DoEvents();
            System.Threading.Thread.Sleep(500);//set time to load

            if (txtUser.Text == "admin" && txtPass.Text == "")
            {
                this.Hide();
                MENU ss = new MENU();
                MessageBox.Show("Welcome to CornerFlag's Product Monitoring System!", "Login Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ss.Show();
            }
            else
            {
                MessageBox.Show("Invalid Input , Try Again ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUser.Clear();
                txtPass.Clear();
            };

        }
        finally
        {
            Cursor.Current = Cursors.Default;
        }

    }