• 设置DataGridview行的字体颜色


    private void dgv_DataSourceChanged(object sender, EventArgs e)
            {
                for (int i = 0; i < dgv.Rows.Count; i++)
                {
                    string CY = (Decimal.Parse(dgv.Rows[i].Cells["MESLPSL"].Value.ToString()) + Decimal.Parse(dgv.Rows[i].Cells["MESFPSL"].Value.ToString() == "" ? "0" : dgv.Rows[i].Cells["MESFPSL"].Value.ToString())
                        - Decimal.Parse(dgv.Rows[i].Cells["SAPLPSL"].Value.ToString() == "" ? "0" : dgv.Rows[i].Cells["SAPLPSL"].Value.ToString()) - Decimal.Parse(dgv.Rows[i].Cells["SAPFPSL"].Value.ToString() == "" ? "0" : dgv.Rows[i].Cells["SAPFPSL"].Value.ToString())).ToString();
    
                    dgv.Rows[i].Cells["CY"].Value = CY;
                    if (CY != "0")
                    {
                        dgv.Rows[i].DefaultCellStyle.ForeColor = System.Drawing.Color.Red;
                    }
                    else
                    {
                        dgv.Rows[i].DefaultCellStyle.ForeColor = System.Drawing.Color.Green;
                    }
                }
            }
  • 相关阅读:
    Netty应用
    原生JDK网络编程- NIO之Reactor模式
    Kafka入门教程
    Java CAS
    Java读写锁
    遍历map的四种方法
    java selector
    Range Sum Query
    Increasing Triplet Subsequence
    Count Numbers with Unique Digits
  • 原文地址:https://www.cnblogs.com/roak/p/14148099.html
Copyright © 2020-2023  润新知