| | |
| | | using DevExpress.Utils; |
| | | using DevExpress.Utils.DirectXPaint; |
| | | using DevExpress.XtraGrid.Columns; |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using DevExpress.XtraPrinting.Native; |
| | | using DevExpress.XtraRichEdit.Layout; |
| | | using Gs.DevApp.DevFrm.QC; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Gs.DevApp.UserControl; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Configuration; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Net; |
| | | using System.Threading.Tasks; |
| | | using System.Web.UI.WebControls; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace Gs.DevApp.DevFrm.QC |
| | |
| | | gvMx1.CustomDrawCell += GvMx1_CustomDrawCell; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断单元格的编辑性 |
| | | /// </summary> |
| | | /// <param name="Column"></param> |
| | | /// <param name="_maxYbs"></param> |
| | | /// <returns></returns> |
| | | private bool ckCol(string ColumnName, string _maxYbs) |
| | | { |
| | | string _FieldName = ColumnName; |
| | | if (!_FieldName.Contains("样本")) |
| | | return false; |
| | | if (_FieldName == "样本数") |
| | | return true; |
| | | if (string.IsNullOrEmpty(_maxYbs)) |
| | | return false; |
| | | string _seqYb = _FieldName.Replace("样本", ""); |
| | | if (int.Parse(_seqYb) > int.Parse(_maxYbs)) |
| | | return false; |
| | | return true; |
| | | } |
| | | |
| | | private void GvMx1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) |
| | | { |
| | | // 判断单元格是否符合条件 && e.CellValue.ToString() == "YourCondition" |
| | | bool _bl = false; |
| | | string _FieldName = e.Column.FieldName; |
| | | //if (e.Column.FieldName == "样本数") |
| | | //{ |
| | | // _bl = true; |
| | | //} |
| | | //e.Appearance.BackColor = Color.LightBlue; // 设置背景色 |
| | | if (_FieldName.Contains("样")) |
| | | string _maxYbs = (gvMx1.GetRowCellValue(e.RowHandle, "样本数").ToString()); |
| | | bool _bl = ckCol(e.Column.FieldName, _maxYbs); |
| | | if (_bl) |
| | | { |
| | | if (_FieldName == "样本数") |
| | | _bl = true; |
| | | else |
| | | { |
| | | string _maxYbs = (gvMx1.GetRowCellValue(e.RowHandle, "样本数").ToString()); |
| | | string _seqYb = _FieldName.Replace("样本", ""); |
| | | if (int.Parse(_seqYb) > int.Parse(_maxYbs)) |
| | | _bl = false; |
| | | else |
| | | _bl = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _bl = false; |
| | | } |
| | | if (_bl) { |
| | | e.Appearance.BackColor = Color.Azure; |
| | | e.Appearance.BackColor = Color.Azure; |
| | | e.Column.MinWidth = 50; |
| | | //e.Appearance.BackColor2 = Color.LightSkyBlue; |
| | | } |
| | | else |
| | | { |
| | | e.Appearance.BackColor = Color.LightGray; |
| | | } |
| | | } |
| | | |
| | | private void GvMx1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) |
| | |
| | | private void GvMx1_ShowingEditor(object sender, System.ComponentModel.CancelEventArgs e) |
| | | { |
| | | DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView; |
| | | string _FieldName = view.FocusedColumn.FieldName; |
| | | if (view.FocusedColumn.FieldName.Contains("样")) |
| | | { |
| | | if (_FieldName == "样本数") |
| | | e.Cancel = false; |
| | | else |
| | | { |
| | | string _maxYbs = (gvMx1.GetRowCellValue(view.FocusedRowHandle, "样本数").ToString()); |
| | | string _seqYb = _FieldName.Replace("样本", ""); |
| | | if (int.Parse(_seqYb) > int.Parse(_maxYbs)) |
| | | e.Cancel = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | string _maxYbs = (gvMx1.GetRowCellValue(view.FocusedRowHandle, "样本数").ToString()); |
| | | bool _bl = ckCol(view.FocusedColumn.FieldName, _maxYbs); |
| | | if (!_bl) |
| | | e.Cancel = true; |
| | | } |
| | | |
| | | } |
| | | |
| | | private void getModel() |