问题描述:

When I set my control's Capture property to true, I receive the mouse events like I expect, but the cursor becomes invisible. Is this expected behavior, and if so, how can I make the cursor displayed when I am capturing it?

Sample Code:

This assumes you have a Form with a TextBox which has the TextChanged event linked appropriately.

Now, the sample code is really for the case of (Form).Capture to keep the sample code short, but I've tested it already and it also causes my mouse to disappear.

public partial class MyForm : Form

{

public MyForm()

{

InitializeComponent();

}

private void TextBox_TextChanged(object sender, EventArgs e)

{

this.Capture = true;

}

}

Type something in the text box and the mouse will disappear.

网友答案:

Mouse capture interrupts the normal flow of mouse processing which includes setting the cursor, so you should manually set the cursor.

相关阅读:
Top