private void detailViewCustomization_CustomEditorStateCustomization111(object sender, CustomEditorStateCustomizationEventArgs e) { if (e.EditorState == EditorState.Disabled) { DXPropertyEditor dxEditor = e.Item as DXPropertyEditor; if (dxEditor != null) { bool disabled = e.Active; if (disabled) { dxEditor.Control.Properties.BorderStyle = BorderStyles.Default; dxEditor.Control.Properties.Appearance.BackColor = Color.FromArgb(245, 245, 245); // Очистка содержимого поля if (dxEditor.AllowEdit) { try { dxEditor.PropertyValue = null; } catch (IntermediateMemberIsNullException) { dxEditor.Refresh(); } } } else { dxEditor.Control.Properties.BorderStyle = BorderStyles.Default; dxEditor.Control.Properties.Appearance.BackColor = Color.Empty; } TextEdit txtBox = dxEditor.Control as TextEdit; if (txtBox != null) { txtBox.TabStop = !disabled; } else { dxEditor.Control.TabStop = !disabled; } } } }
private void detailViewCustomization_CustomEditorStateCustomization(object sender, CustomEditorStateCustomizationEventArgs e) { //DXPropertyEditor dxEditor = e.Item as DXPropertyEditor; //if (dxEditor != null) { // dxEditor.Control.Properties.BorderStyle = BorderStyles.Office2003; // dxEditor.Control.Properties.Appearance.BackColor = Color.FromArgb(245, 255, 255); // Color.FromArgb(245, 0, 0); //} //return; if (e.EditorState == EditorState.Disabled) { DXPropertyEditor dxEditor = e.Item as DXPropertyEditor; if (dxEditor != null) { bool disabled = e.Active; if (disabled) { dxEditor.Control.Properties.BorderStyle = BorderStyles.Default; dxEditor.Control.Properties.Appearance.BackColor = Color.FromArgb(245, 245, 245); // Очистка содержимого поля if (dxEditor.AllowEdit) { try { dxEditor.PropertyValue = null; } catch (IntermediateMemberIsNullException) { dxEditor.Refresh(); } } } else { dxEditor.Control.Properties.BorderStyle = BorderStyles.Default; dxEditor.Control.Properties.Appearance.BackColor = Color.Empty; } TextEdit txtBox = dxEditor.Control as TextEdit; if (txtBox != null) { txtBox.TabStop = !disabled; } else { dxEditor.Control.TabStop = !disabled; } } } /* * e.Handled = true; * //if (e.EditorState != EditorState.Disabled & e.EditorState != EditorState.Hidden) { * * DetailView detailView = (DetailView)View; * foreach (PropertyEditor editor in detailView.GetItems<PropertyEditor>()) { * Attribute attr = editor.MemberInfo.FindAttribute<RuleRequiredFieldAttribute>(); * if (attr != null) { * * // Исследование структуры редакторов элементов * DXPropertyEditor dxEditor = editor as DXPropertyEditor; * //object dvi = editor.Control; * if (dxEditor != null && dxEditor.Control != null) { * //Control.ControlCollection contrcol = dxEditor.Control.Controls; * dxEditor.Control.Properties.Appearance.BackColor = Color.FromArgb(255, 0, 0); * } * * if (dxEditor != null) { * bool disabled = e.Active; * if (disabled) { * dxEditor.Control.Properties.BorderStyle = BorderStyles.Default; * dxEditor.Control.Properties.Appearance.BackColor = Color.FromArgb(245, 255, 255); * } * } * } * } * * //} */ }