4 个解决方案
#1
DataGrid1.Items(i).BackColor=myColor
#2
How can I select the entire row when the user clicks on a cell in the row?
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q689q
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q689q
#3
供参考,我这是改变列的颜色代码,我用的是DataGridView控件。
Private Sub DataGridView_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView.CellFormatting
Select Case e.ColumnIndex
Case 1,5,6
e.CellStyle.BackColor = Color.red
case else
end select
end sub
Private Sub DataGridView_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView.CellFormatting
Select Case e.ColumnIndex
Case 1,5,6
e.CellStyle.BackColor = Color.red
case else
end select
end sub
#4
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.datagrid1.Items(0).Attributes.Add("style", "background-color:red;")
Me.datagrid1.Items(4).Attributes.Add("style", "background-color:red;")
Me.datagrid1.Items(5).Attributes.Add("style", "background-color:red;")
End Sub
ByVal e As System.EventArgs) Handles MyBase.Load
Me.datagrid1.Items(0).Attributes.Add("style", "background-color:red;")
Me.datagrid1.Items(4).Attributes.Add("style", "background-color:red;")
Me.datagrid1.Items(5).Attributes.Add("style", "background-color:red;")
End Sub
#1
DataGrid1.Items(i).BackColor=myColor
#2
How can I select the entire row when the user clicks on a cell in the row?
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q689q
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q689q
#3
供参考,我这是改变列的颜色代码,我用的是DataGridView控件。
Private Sub DataGridView_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView.CellFormatting
Select Case e.ColumnIndex
Case 1,5,6
e.CellStyle.BackColor = Color.red
case else
end select
end sub
Private Sub DataGridView_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView.CellFormatting
Select Case e.ColumnIndex
Case 1,5,6
e.CellStyle.BackColor = Color.red
case else
end select
end sub
#4
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.datagrid1.Items(0).Attributes.Add("style", "background-color:red;")
Me.datagrid1.Items(4).Attributes.Add("style", "background-color:red;")
Me.datagrid1.Items(5).Attributes.Add("style", "background-color:red;")
End Sub
ByVal e As System.EventArgs) Handles MyBase.Load
Me.datagrid1.Items(0).Attributes.Add("style", "background-color:red;")
Me.datagrid1.Items(4).Attributes.Add("style", "background-color:red;")
Me.datagrid1.Items(5).Attributes.Add("style", "background-color:red;")
End Sub