zoukankan      html  css  js  c++  java
  • 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);
                }

  • 相关阅读:
    xml
    反射
    类加载器
    tcp通信
    UDP通信
    UDP与TCP协议
    网络通信协议
    符合汽车安全和质量标准的CYPRESS FRAM
    SRAM是什么存储器
    网络通信与便携式应用驱动SRAM技术发展
  • 原文地址:https://www.cnblogs.com/lgxll/p/2549039.html
Copyright © 2011-2022 走看看