private void Control_Validating(object sender, CancelEventArgs e) { BaseEdit control = sender as BaseEdit; if (control != null && _collection.ContainsKey(control)) { bool iscancel = (control.FindForm().DialogResult == DialogResult.Cancel) && _ignoreOnCancel; bool error = !iscancel && _collection[control] && (control.EditValue == null || control.EditValue.ToString().Trim().Length == 0); SetError(control, error ? "Не указано значение обязательного поля" : null); e.Cancel = error; if (error) { control.Focus(); } } }
public void ShowPopupForm() { Point location = _OwnerEdit.PointToScreen(new Point(0, 0)); location.Y += _OwnerEdit.Height; Location = location; Size = new Size(_OwnerEdit.Width, 200); if (_attachedToParentForm) { Show(_OwnerEdit.FindForm()); } else { Show(); } Location = location; }