[英]C#: Detect Mouse Events (Enter, Leave, Down, etc.)
我的光標與GRIDVIEW中的文本框交互時,需要有此事件。 我嘗試使用TextBox1_MouseEnter或其他任何方法,但是IntelliSense不能幫助我。 我是否缺少名稱空間? 我沒有從哪里開始控制鼠標事件的想法。
Gridview TextBox1_MouseEnter
上沒有事件,請嘗試使用此代碼。
private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
dataGridView1[e.ColumnIndex, e.RowIndex].Style.SelectionBackColor = Color.Blue;
}
private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
dataGridView1[e.ColumnIndex, e.RowIndex].Style.SelectionBackColor = Color.Empty;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.