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, "进度跟进", "");
}
// }
//}
}
}
}

gridControl 中CellValueChanged,ShowingEditor,CustomDrawCell的用法的更多相关文章

  1. Spring mvc中@RequestMapping 6个基本用法

    Spring mvc中@RequestMapping 6个基本用法 spring mvc中的@RequestMapping的用法.  1)最基本的,方法级别上应用,例如: Java代码 @Reques ...

  2. Delphi中stringlist分割字符串的用法

    Delphi中stringlist分割字符串的用法 TStrings是一个抽象类,在实际开发中,是除了基本类型外,应用得最多的. 常规的用法大家都知道,现在来讨论它的一些高级的用法. 1.CommaT ...

  3. Linq中关键字的作用及用法

    Linq中关键字的作用及用法 1.All:确定序列中的所有元素是否都满足条件.如果源序列中的每个元素都通过指定谓词中的测试,或者序列为空,则为 true:否则为 false. Demo: 此示例使用 ...

  4. 标准C++中的string类的用法总结

    标准C++中的string类的用法总结 相信使用过MFC编程的朋友对CString这个类的印象应该非常深刻吧?的确,MFC中的CString类使用起来真的非常的方便好用.但是如果离开了MFC框架,还有 ...

  5. html中的alt和title用法区别

    html中的alt和title用法区别 首先明确一下概念,alt是html标签的属性,而title既是html标签,又是html属性.title标签这个不用多说,网页的标题就是写在<title& ...

  6. HTML中的target(_self,_blank)用法总结

    HTML中的target(_self,_blank)用法总结 最近一个项目,多次遇到target='_self', target='_blank'的用法, 再次总结一下: 1.<a>标签 ...

  7. jquery中append跟prepend的用法

    jquery中append和prepend的用法 append   是插入到元素中,并放到元素内的最后面prepend  是插入到元素中,并放到元素内的最前面例$("body"). ...

  8. js正则表达式中的问号几种用法小结

    这篇文章主要介绍了js正则表达式中的问号几种用法,比如+?,*?,{2,3}?可以停止匹配的贪婪模式,感兴趣的朋友可以参考下 在表示重复的字符后面加问号,比如+?,*?,{2,3}?可以停止匹配的贪婪 ...

  9. SQL Server 中 with tmp 临时表的用法

    SQL Server 中 with tmp 临时表的用法 ----------with临时表用法,有时候采用临时表比采用in的效率更高,避免了全表扫描. 实例中实现了查询普通题.大题.子题目的sql ...

随机推荐

  1. 安装VMWare WorkStation 10 异常【 Failed to create the requested registry keyKey:Installer Error: 1021】

    下载了新的workstation 10,在安装的时候出现了异常Failed to create the requested registry keyKey:Installer Error: 1021. ...

  2. 学习笔记:shell 中 [-eq] [-ne] [-gt] [-lt] [ge] [le]

    -eq           //等于 -ne           //不等于 -gt            //大于 (greater ) -lt            //小于  (less) -g ...

  3. select空间提交form表单传递参数

    如下, 到了 <form name="modelForm" action="/portal/defectinfo/toDefectPage?projectname= ...

  4. Table表格横竖线实现Css

    .tablel { border-collapse:collapse; /* 关键属性:合并表格内外边框(其实表格边框有2px,外面1px,里面还有1px哦) */ border:solid #999 ...

  5. x264宏块及子块划分方式

    1 宏块划分方式 一副图像(帧,非场图像,x264支持宏块级场编码,这里以帧图像为例说明)按从左到右.从上到下16x16的方式划分宏块,对于图像宽度不是16的倍数的情况,会扩展至16的倍数,然后通过s ...

  6. CSS:haslayout知多少

    我们都知道浏览器有bug,而IE的bug似乎比大多数浏览器都多.IE的表现与其他浏览器不同的原因之一就是,显示引擎使用一个称为布局(layout)的内部概念.   因为布局是专门针对显示引擎内部工作方 ...

  7. 数据库还原失败System.Data.SqlClient.SqlError: 无法执行 BACKUP LOG,因为当前没有数据库备份

    结尾日志的问题 还原选择中去掉结尾日志就可以了 转载自:http://blog.csdn.net/aojiancc2/article/details/46316451

  8. CustomSummaryCalculate 用法

    private void gridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs ...

  9. ITest

    渗透测试入门 我很简单,请不要欺负我 网站综合渗透实验: 真的很简单: 你是会员吗: 2015中国网络安全大赛 一.代码执行: 同DZ漏洞全家桶中的"又见DZ,我能那你怎么办". ...

  10. 【转】使用sinopia五步快速完成本地npm搭建

    使用sinopia五步快速完成本地npm搭建 时间 2016-03-01 14:55:30  繁星UED 原文  http://ued.fanxing.com/shi-yong-sinopiawu-b ...