• Winfrom 的Click、RowPrePaint两个函数用法


    gridview 的SelectedIndexChanging 可以在Winform里的Click里实现

    例如行的变化,获取行变化的值

     if (dataGridView1.Rows.Count > 0)
     {
                    string str = dataGridView1.SelectedRows[0].Cells["WOID"].Value.ToString();
                    label1.Text = str;

    }

    gridview 的RowDataBound 可以在Winform里的RowPrePaint里实现

    例如在某值范围内改变字体颜色或行背景颜色

     if (e.RowIndex >= dataGridView1.Rows.Count - 1)
                {
                    return;
                }
                DataGridViewRow dgr = dataGridView1.Rows[e.RowIndex];
                try
                {
                    if (Convert.ToInt32(dgr.Cells["WOID"].Value.ToString()) > 4)
                    {
                        dgr.DefaultCellStyle.ForeColor = System.Drawing.Color.Red;
                        dgr.DefaultCellStyle.BackColor = System.Drawing.Color.Blue;
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

  • 相关阅读:
    算法市场 Algorithmia
    Cucumber
    TeamCity 持续集成工具
    自动化测试
    Selenium
    Android耗时操作
    RecyclerView
    Android报错
    Lakeshore
    BaaS_后端即服务 RESTful
  • 原文地址:https://www.cnblogs.com/lgxll/p/2549039.html
Copyright © 2020-2023  润新知