datagrid记录隔行换背景颜色怎么实现?
最好代码详细些~

解决方案 »

  1.   

    你在datagrid的itemdatabound事件中添加处理,datagrid记录就会隔行换背景颜色。如以下代码:Sub TestDataGrid_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)        If e.Item.ItemIndex = -1 Then Exit Sub        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then            e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#A3CDE2'")        End If        If e.Item.ItemType = ListItemType.Item Then            e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#EFFCFB'")        Else            e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='White'")        End If    End Sub
      

  2.   

    我在vc6.0里没看见itemdatabound事件啊,不是.net里的消息吧~
    我现在用6.0啊~看来没法实现啊~
      

  3.   

    vc6中基本无法实现,datagrid控件不支持,不过可以使用其他控件。
    对于斑马线的编程问题,可以使用listctrl控件来灵活编程实现。datagrid功能不强,我都是使用这个东东的http://www.codeproject.com/miscctrl/gridctrl.asp
    希望你不要动不动就要代码,自己要学会灵活应用。vc的功能很强,高质量的代码许多都是采用VC编写的,我在深圳
    --NAME:余 翔
    TEL:13510876790
    E-mail:[email protected]