private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
Point pt = new Point(e.X,e.Y);
DataGrid.HitTestInfo hit = dataGrid1.HitTest(pt);
if(hit.Type == DataGrid.HitTestType.Cell) 
{
dataGrid1.Select(hit.Row); 
}
}

解决方案 »

  1.   

    DataGridItem row =e.Item;
    if(row.DataItem !=null)

    row.Cells[2].ToolTip=row.Cells[1].Text.ToString()+"\n"+row.Cells[1].Text.ToString();  div.Value=row.Cells[2].ToolTip;
    this.detail.InnerHtml=row.Cells[2].ToolTip;   ShowMessage(this,row.ItemIndex.ToString()  );
    if (row.ItemIndex%2==0)
    {
    row.ForeColor =System.Drawing.Color.MediumSpringGreen; 
    // row.ForeColor =System.Drawing.ColorTranslator .MediumSpringGreen; 
    // row.ForeColor =System.Drawing.Color.FromArgb(); 
    }
    else
    {
    row.BackColor =System.Drawing.Color.BlueViolet;     
    }
    row.Attributes["onmouseover"] =" div.value='kkk';this.className='MouseOverStyle';";
    row.Attributes["onmouseout"] ="this.className='MouseOutStyle';";
    }