C/S 中怎樣為dataGrid每一行加MouseMove事件,可以這樣做嗎?
我想使鼠標移上dataGrid中的某一行,就能讓此行的背景顏色改變。

解决方案 »

  1.   

    可以!
    在DataGrid的ItemDataBound事件中我的是改变字体大小,你可以参考一下:
    //鼠标移动至某行时字体变粗
    e.Item.Attributes["onmouseover"]="JavaScript:this.style.fontWeight='bold';this.style.cursor='hand';";
    e.Item.Attributes["onmouseout"] = "JavaScript:this.style.fontWeight='normal';";
      

  2.   

    當鼠標移上某行時,我用以下語句,改變了一行顏色。
    this.dataGrid1.SelectionBackColor=Color.Red;但鼠標移開時,我就不知  this.dataGrid1.SelectionBackColor=?
    才能恢復原來的樣子。
      

  3.   

    vs2005的datagridview有cellmousemove事件
      

  4.   

    可以加的,自己定义个tablestyle,然后在里面加事件