| | |
| | | txt.Enabled = !isEdt; |
| | | continue; |
| | | } |
| | | //if (colType is CheckEdit) |
| | | //{ |
| | | // var txt = colType as CheckEdit; |
| | | // if (txt != null) |
| | | // txt.Checked = bool.Parse(strVal); |
| | | // txt.ReadOnly = isEdt; |
| | | // continue; |
| | | //} |
| | | |
| | | //时间 |
| | | if (colType is DateTimePicker) |
| | | { |
| | |
| | | txt.ReadOnly = isEdt; |
| | | continue; |
| | | } |
| | | if (ctrl is MemoEdit) |
| | | { |
| | | var txt = ctrl as MemoEdit; |
| | | if (txt != null) |
| | | txt.Text = ""; |
| | | txt.ReadOnly = isEdt; |
| | | continue; |
| | | } |
| | | |
| | | //时间 |
| | | if (ctrl is DateTimePicker) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 禁用或启用容器里面的控件 |
| | | /// </summary> |
| | |
| | | } |
| | | } |
| | | |
| | | private static bool _isRead(object obj,bool isEdt=false) |
| | | private static bool _isRead(object obj, bool isEdt = false) |
| | | { |
| | | ///永远是只读的 |
| | | if (obj != null && obj.ToString().ToUpper()==("readOnly".ToUpper())) |
| | | if (obj != null && obj.ToString().ToUpper() == ("readOnly".ToUpper())) |
| | | { |
| | | return true; |
| | | } |
| | | ///永远是可写的 |
| | | if (obj != null && obj.ToString().ToUpper()==("readOnly-1".ToUpper())) |
| | | if (obj != null && obj.ToString().ToUpper() == ("readOnly-1".ToUpper())) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | public static void SetGridViewParameter(GridView gridView1, PictureBox picCheckBox = null, Form fm = null, string fileName = "checkStatus", string icoName = "", DelegateGetModel action = null) |
| | | { |
| | | gridView1.OptionsView.ColumnAutoWidth = false;//自动调整列宽 |
| | | // gridView1.BestFitColumns();//数据绑定到GridView之后调用BestFitColumns()方法 |
| | | foreach (GridColumn column in gridView1.Columns) |
| | | { |
| | | column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains; |
| | |
| | | view.ActiveEditor.MouseUp += ActiveEditor_MouseUp; |
| | | }; |
| | | } |
| | | |
| | | gridView1.RowStyle += (s, e) => |
| | | { |
| | | gridView1.OptionsSelection.EnableAppearanceFocusedRow = false;//默认选中行不变色 |
| | | gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;//默认选中单元格不变色 |
| | | if (e.RowHandle >= 0) |
| | | { |
| | | DataRow row = gridView1.GetDataRow(e.RowHandle); |
| | | if (row == null) |
| | | return; |
| | | bool columnExists = row.Table.Columns.Contains("isRed"); |
| | | if (columnExists == true) |
| | | { |
| | | string _isRed = row["isRed"].ToString(); |
| | | if (_isRed == "1") |
| | | { |
| | | e.Appearance.BackColor = Color.LightPink; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | private static void ActiveEditor_MouseUp(object sender, MouseEventArgs e) |
| | | { |