rt

解决方案 »

  1.   


    private void dataGridView1_MouseMove(object sender, MouseEventArgs e)
    {
        DataGridView.HitTestInfo hti = dataGridView1.HitTest(e.X, e.Y);
        if (hti.Type == DataGridViewHitTestType.Cell)
        {
            MessageBox.Show(hti.ColumnIndex.ToString() + "," + hti.RowIndex.ToString());
        }
    }
      

  2.   


    加进去了 没反应...namespace WindowsFormsApplication4
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void dg1_MouseMove(object sender, MouseEventArgs e)
            {
                DataGridView.HitTestInfo hti = dataGridView1.HitTest(e.X, e.Y);
                if (hti.Type == DataGridViewHitTestType.Cell)
                {
                    MessageBox.Show(hti.ColumnIndex.ToString() + "," + hti.RowIndex.ToString());
                }
            }
                   
        }
    }