TextBox类netCF中Click和Focus()有什么区别?

时间:2014-12-03 08:41:22

标签: c# focus windows-ce

    private void textBox1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.Enter)
            textBox2.Focus();
    }

    private void textBox2_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.Enter)
            CursorTest();

    }

    private void button4_Click(object sender, EventArgs e)
    {
        CursorTest();
    }


    private void CursorTest()
    {
        Cursor.Current = Cursors.WaitCursor;

        for (int i = 0; i < 100; i++)
            System.Diagnostics.Debug.WriteLine(i.ToString());

        Cursor.Current = Cursors.Default;

    }

案例1:我点击button4, - CursorTest()显示waitcursor

案例2:我在textBox1上输入'ENTER'并将焦点移到textBox2

并在textBox2上再次输入'ENTER' - CursorText()不会出现waitcursor。

案例3:我只需单击textBox2并输入'ENTER' - CursorText()出现waitcursor。

如何在所有情况下显示Wait-Cursor? Click和Focus()有什么区别?

1 个答案:

答案 0 :(得分:0)

检查TextBox.TextChanged事件并从那里调用CursorTest()。这将有效。

    private void textBox1_TextChanged(object sender, EventArgs e)
    {
        CursorTest();
    }