- PR -

DataGridViewの行にマウスカーソルが上に来た時の処理方法

投稿者投稿内容
かるあ
ぬし
会議室デビュー日: 2003/11/16
投稿数: 1190
お住まい・勤務地: センガワ→ムサシノ
投稿日時: 2006-07-05 10:55
やり直してみました。
CellMouseMove よりも CellMouseEnter のが適切ですよね・・・

コード:

private void dataGridView1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
DataGridViewCellStyle ds = new DataGridViewCellStyle();
ds.BackColor = Color.Blue;

DataGridView dgv = (DataGridView)sender;
for (int rowIndex = 0; rowIndex < dgv.Rows.Count; rowIndex++ )
{
dgv.Rows[rowIndex].DefaultCellStyle = null;
}

if (e.RowIndex >= 0)
{
dgv.Rows[e.RowIndex].DefaultCellStyle = ds;
}

}



[ メッセージ編集済み 編集者: かるあ 編集日時 2006-07-05 11:02 ]

スキルアップ/キャリアアップ(JOB@IT)