- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
private void SetRowColor()
{
DataGridView dg = new DataGridView();
dg.Sorted += new EventHandler(DataGridView1_Sorted);
foreach (DataGridViewColumn col in DataGridView1.Columns)
{
if (col is DataGridViewTextBoxColumn)
{
if (col.HeaderText == "Status")
{
foreach (DataGridViewRow dgRow in DataGridView1.Rows)
{
if (dgRow.Cells[col.Index].Value.ToString() == "0" || dgRow.Cells[col.Index].Value.ToString() == "Inactive")
{
DataGridViewCellStyle dStyle = new DataGridViewCellStyle();
dStyle.BackColor = Color.Goldenrod;
dStyle.Padding = new System.Windows.Forms.Padding(3, 0, 0, 0);
dgRow.DefaultCellStyle = dStyle;
}
}
}
if (col.HeaderText == "StatusID")
{
foreach (DataGridViewRow dgRow in DataGridView1.Rows)
{
if (dgRow.Cells[col.Index].Value.ToString() == "0" || dgRow.Cells[col.Index].Value.ToString() == "Inactive")
{
DataGridViewCellStyle dStyle = new DataGridViewCellStyle();
dStyle.BackColor = Color.Goldenrod;
dStyle.Padding = new System.Windows.Forms.Padding(3, 0, 0, 0);
dgRow.DefaultCellStyle = dStyle;
}
}
}
}
//if (DataGridView1.Columns[i].ValueType == typeof(System.DateTime) && DataGridView1.Columns[i].Name != "CreateTS" && DataGridView1.Columns[i].Name != "ModifyTS" && DataGridView1.Columns[i].Name != "InactiveTS" && DataGridView1.Columns[i].Name != "PrintedTS")
//{
// DataGridView1.Columns[i].DefaultCellStyle.Format = m_strDateFormat;
// DataGridView1.Columns[i].Width = m_strDateFormat == "dd MMM yyyy hh:mm:ss tt" ? 150 : DataGridView1.Columns[i].Width;
//}
//DataGridView1.Columns[i].DefaultCellStyle.
}
}
Новая работа. WinForms.
90% примерно такое.
taburetka 24.01.2013 10:46 # 0
kore_sar 24.01.2013 10:47 # 0
wvxvw 26.01.2013 22:03 # 0
kore_sar 05.02.2013 07:27 # 0