• gridControl 中CellValueChanged,ShowingEditor,CustomDrawCell的用法


    private void gridView1_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
    {
    int hand = e.RowHandle;
    if (hand >= 0)
    {
    if (e.Column.FieldName == "OneV")
    {
    string obj =gridView1.GetRowCellValue(hand, "Obj").ToString();
    if (obj == "高压" || obj == "低压")
    {
    e.Appearance.BackColor = Color.Red;
    }

                  }
              }
    
        }
    

    private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
    {
    if (gridView1.GetDataRow(e.RowHandle) == null)
    return;
    if (e.Column.FieldName == "未完成数量" || e.Column.FieldName == "入库未完成数量")
    {
    int WeiWangChengShu = this.gridView1.GetRowCellValue(e.RowHandle, "未完成数量").ToString() == "" ? 0 : int.Parse(this.gridView1.GetRowCellValue(e.RowHandle, "未完成数量").ToString());
    int RukuWeiWangChengShu = this.gridView1.GetRowCellValue(e.RowHandle, "入库未完成数量").ToString() == "" ? 0 : int.Parse(this.gridView1.GetRowCellValue(e.RowHandle, "入库未完成数量").ToString());
    if (WeiWangChengShu > 0 || RukuWeiWangChengShu > 0)
    {
    this.gridView1.SetRowCellValue(e.RowHandle, "进度跟进", "未完成");
    }
    }
    }

    private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
    {
    int thisIndex = this.gridView1.FocusedRowHandle;
    if (thisIndex < 0)
    {
    return;
    }
    string shengChangType = this.gridView1.GetRowCellValue(thisIndex, "生产类型").ToString();
    if (shengChangType != "包装")
    {
    if (this.gridView1.FocusedColumn.FieldName == "未完成数量" || this.gridView1.FocusedColumn.FieldName == "入库未完成数量")
    {
    e.Cancel = true;
    }
    }
    }

    private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
    {
    if (this.gridView1.FocusedColumn == e.Column)
    {
    if (e.Column == this.未完成数量 || e.Column == this.入库未完成数量)
    {
    //String strUnitNum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "未完成数量").ToString();
    //String strRukuUnitNum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "入库未完成数量").ToString();//入库未完成数量
    int strnum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "未完成数量").ToString()==""?0:int.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "未完成数量").ToString());
    int strRukuNum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "入库未完成数量").ToString() == "" ? 0 :int.Parse( gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "入库未完成数量").ToString());
    //if(int.TryParse(strUnitNum,out strnum))
    //{
    // if (int.TryParse(strRukuUnitNum,out strRukuNum))
    // {
    //生产类型=‘包装‘的时候 ;输入的未完成数量/入库未完成数量 不允许大于 任务数;当生产类型<>‘包装’的时候 未完成数量/入库未完成数量 不允许编辑
    if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "生产类型").ToString() == "包装")
    {
    int tasknum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "任务数").ToString() == "" ? 0 : int.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "任务数").ToString());
    if (strnum > tasknum || strRukuNum > tasknum)
    {
    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "未完成数量", "0");
    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "入库未完成数量", "0");
    return;
    }
    }

                            if (strnum > 0 || strRukuNum>0)
                            {
                                gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "进度跟进", "未完成");
                            }
                            else
                            {
                                gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "进度跟进", "");
                            }
                    //    }
                    //}
                }
            }
        }
  • 相关阅读:
    sp_trace_setfilter sqlserver筛选跟踪或跟踪过滤
    sp_trace_setevent sqlserver跟踪事件及列
    通过导入虚拟电脑的方式还原centos
    sqlserver profiler 抓出来作业的代码 SQLAgent
    克隆server2008R2造成SID冲突
    sqlserver ssms ctrl+e快捷键问题
    Caffe源码解析1:Blob
    梯度下降、随机梯度下降和批量梯度下降
    Caffe CNN特征可视化
    Caffe 抽取CNN网络特征 Python
  • 原文地址:https://www.cnblogs.com/VictorBlog/p/5652279.html
Copyright © 2020-2023  润新知