private void VCCorreo_ViewControlsCreated(object sender, EventArgs e) { DetailView dv = View as DetailView; if (dv != null) { List <string> mails = new List <string>(); mails.Clear(); mails.Add("smtp.gmail.com"); mails.Add("smtp.live.com"); mails.Add("smtp.prodigy.net.mx"); mails.Add("smtp.mail.yahoo.com"); CustomStringEditor clE = dv.FindItem("ServidorSMTP") as CustomStringEditor; if (clE != null) { clE.Control.Validated += Control_Validated; (clE.Control as ComboBoxEdit).Properties.Items.Clear(); for (int i = 0; i < mails.Count; i++) { (clE.Control as ComboBoxEdit).Properties.Items.Add(mails[i]); } } foreach (ViewItem w in dv.Items) { DXPropertyEditor ww = w as DXPropertyEditor; if (ww != null && ww.Control != null) { ww.Control.EnterMoveNextControl = true; } } } }
private void AppearenceController_CustomApplyAppearance(object sender, ApplyAppearanceEventArgs e) { DXPropertyEditor dxEditor = e.Item as DXPropertyEditor; if (dxEditor != null && dxEditor.Control != null && nested && dxEditor.Caption == "Country") { ((IAppearanceVisibility)dxEditor).Visibility = ViewItemVisibility.Hide; } }
protected override void CustomizeDisabledEditorsAppearance(ApplyAppearanceEventArgs e) { base.CustomizeDisabledEditorsAppearance(e); DXPropertyEditor dxEditor = e.Item as DXPropertyEditor; if (dxEditor != null && dxEditor.Control != null) { dxEditor.Control.Properties.Appearance.BackColor = Color.RosyBrown; dxEditor.Control.Properties.BorderStyle = BorderStyles.Simple; } }
private void HighLightProperty(DXPropertyEditor dxEditor, bool Astra) { //DXPropertyEditor dxEditor = e.Item as DXPropertyEditor; if (dxEditor != null) { //dxEditor.Control..Properties.BorderStyle = BorderStyles.Default; //dxEditor.Control.Properties.Appearance.BackColor = Color.FromArgb(245, 245, 245); if (Astra) { string caption = dxEditor.Caption; while (caption.IndexOf(" * *") > -1) { caption = caption.Replace(" * *", " *"); } if (caption.IndexOf(" *") == -1) { dxEditor.Caption = caption + " *"; } //while (dxEditor.Caption.IndexOf(" * *") > -1) dxEditor.Caption.Replace(" * *", " *"); } else { string caption = dxEditor.Caption; caption = caption.Replace(" *", ""); dxEditor.Caption = caption; } //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 int GetFilterHight(DetailView detailView) { int height = -1; foreach (PropertyEditor editor in detailView.GetItems <PropertyEditor>()) { DXPropertyEditor dxEditor = editor as DXPropertyEditor; if (dxEditor == null) { continue; } //if (!dxEditor.Control.Visible) continue; int summa = dxEditor.Control.ClientSize.Height + dxEditor.Control.Location.Y; if (height < summa) { height = summa; // +dxEditor.Control.Bottom; } } return(height); }
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 VCVentaABC_ViewControlsCreated(object sender, EventArgs e) { DetailView dv = View as DetailView; if (dv != null) { foreach (ViewItem w in dv.Items) { DXPropertyEditor ww = w as DXPropertyEditor; if (ww != null && ww.Control != null) { ww.Control.EnterMoveNextControl = true; } } } StringPropertyEditor prd = dv.FindItem("PrdctCptr") as StringPropertyEditor; if (prd != null) { prd.Control.Validated += Control_Validated; prd.Control.KeyUp += Control_KeyUp; } // Primero lo primero con el ratón LookupPropertyEditor prdl = dv.FindItem("Prdct") as LookupPropertyEditor; if (prdl != null) { prdl.Control.KeyUp += Control_KeyUp1; prdl.Control.KeyPress += Control_KeyPress; prdl.Control.KeyDown += Control_KeyDown; prdl.Control.Validating += Control_Validating; prdl.Control.Validated += Control_Validated1; prdl.Control.CloseUp += Control_CloseUp; prdl.Control.Closed += Control_Closed; } }
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); * } * } * } * } * * //} */ }
private void RecolorFields() { DetailView detailView = (DetailView)View; foreach (PropertyEditor editor in detailView.GetItems <PropertyEditor>()) { //if (!editor.AllowEdit) continue; // Исследование структуры редакторов элементов /* * 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(215, 255, 255); * } */ Attribute attr = editor.MemberInfo.FindAttribute <RuleRequiredFieldAttribute>(); if (attr != null) { // Перехват LostFocus - отменён 2011-08-01 //((System.Windows.Forms.Control)editor.Control).LostFocus += new EventHandler(FormField_LostFocus); // Раскраска обязательных полей на форме (в пользовательской модели не запоминается) DXPropertyEditor dxEditor = editor as DXPropertyEditor; if (dxEditor.Control != null) { if (!editor.AllowEdit) { // SHU!!! 2011-09-07 Три строки, которые управляют украшениями dxEditor.Control.ForeColor = Color.FromArgb(0, 100, 0); dxEditor.Control.Properties.BorderStyle = BorderStyles.Default; dxEditor.Control.Properties.Appearance.BackColor = Color.FromArgb(245, 245, 245); } else { // SHU!!! 2011-09-07 Три строки, которые управляют украшениями dxEditor.Control.ForeColor = Color.FromArgb(0, 0, 0); dxEditor.Control.Properties.BorderStyle = BorderStyles.Office2003; dxEditor.Control.Properties.Appearance.BackColor = Color.FromArgb(255, 235, 245); } /* * // Добавляем атрибут для выделения заголовка поля - НЕ РАБОТАЕТ ПО НЕИЗВЕСТНЫМ ПРИЧИНАМ * // http://documentation.devexpress.com/#Xaf/CustomDocument3286 * // http://www.devexpress.com/Support/Center/p/Q298805.aspx * //XafTypesInfo.Instance.FindTypeInfo(typeof(PersistentObject1)).AddAttribute(new DevExpress.Persistent.Base.DefaultClassOptionsAttribute()); * //[Appearance("DisplaySummMode.Caption.Bold", AppearanceItemType.LayoutItem, "true", FontStyle = FontStyle.Bold)] * string AttrId = dxEditor.Id + ".Caption.Bold"; * AppearanceAttribute AppearAttr = new AppearanceAttribute(AttrId); * AppearAttr.AppearanceItemType = AppearanceItemType.LayoutItem.ToString(); * AppearAttr.BackColor = "Red"; * AppearAttr.FontColor = "Blue"; * AppearAttr.FontStyle = FontStyle.Bold; * AppearAttr.Criteria = "isnull(" + dxEditor.Id + ") OR not isnull(" + dxEditor.Id + ")"; * AppearAttr.TargetItems = dxEditor.Id; * dxEditor.MemberInfo.AddAttribute(AppearAttr); * dxEditor.Refresh(); * //editor.MemberInfo.AddAttribute(AppearAttr); * //editor.Refresh(); */ } } } }