public void OpenFieldHandler(object sender, GoToFieldEventArgs e) { StringBuilder display = new StringBuilder(); ControlFactory factory = ControlFactory.Instance; Field field = factory.GetAssociatedField((Control)sender); if (!string.IsNullOrEmpty(field.Name)) { display.Append(string.Format("[ {0}:{1} ] ", SharedStrings.NAME , field.Name)); } if ((Control)sender is MaskedTextBox) { if (DisplayFormat != null) { string pattern = ((IPatternable)field).Pattern; if (!string.IsNullOrEmpty(field.Name)) { display.Append(string.Format("[ {0}:{1} ] ", SharedStrings.MASK, pattern)); } } } if (field is DateField && (string.IsNullOrEmpty(field.Name) == false)) { System.Globalization.DateTimeFormatInfo formatInfo = System.Globalization.DateTimeFormatInfo.CurrentInfo; display.Append(string.Format("[ {0}:{1} {2} ] ", SharedStrings.TYPE, field.FieldType, formatInfo.ShortDatePattern.ToUpper())); if (((DateField)field).LowerDate.Ticks > 0) { display.Append(string.Format("[ Lower: {0} ] ", ((DateField)field).LowerDate.ToShortDateString())); } if (((DateField)field).UpperDate.Ticks > 0) { display.Append(string.Format("[ Upper: {0} ] ", ((DateField)field).UpperDate.ToShortDateString())); } } else if (string.IsNullOrEmpty(field.Name) == false) { display.Append(string.Format("[ {0}:{1} ] ", SharedStrings.TYPE, field.FieldType)); } DisplayFormat(display.ToString(), new EventArgs()); this.EnterCheckCodeEngine.CheckCodeHandler(sender, new RunCheckCodeEventArgs(EventActionEnum.OpenField, e.Field.Name)); }
/// <summary> /// Handles the Enter event for controls /// </summary> /// <param name="sender">Object that fired the event</param> /// <param name="e">.NET supplied event parameters</param> private void control_Enter(object sender, EventArgs e) { if (this.GotoFieldEvent != null) { Field field = ControlFactory.Instance.GetAssociatedField((Control)sender); GoToFieldEventArgs args = new GoToFieldEventArgs(field); this.GotoFieldEvent(sender, args); } ControlFactory factory = ControlFactory.Instance; if (factory.IsPopup) { for (int ix = ((Control)sender).Parent.Controls.Count - 1; ix >= 0; ix--) if (((Control)sender).Parent.Controls[ix] is MonthCalendar) { ((Control)sender).Parent.Controls.Remove(((Control)sender).Parent.Controls[ix]); factory.IsPopup = false; } } }