/// <summary> /// 注册事件 /// </summary> /// <param name="control">控件</param> private void RegisterEvents(ControlA control) { ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickButton); ControlEvent spinInputChangedEvent = new ControlEvent(SpinTextChanged); List <ControlA> controls = control.GetControls(); int controlsSize = controls.Count; for (int i = 0; i < controlsSize; i++) { ButtonA button = controls[i] as ButtonA; if (button != null) { button.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } SpinA spin = controls[i] as SpinA; if (spin != null) { spin.RegisterEvent(spinInputChangedEvent, EVENTID.TEXTCHANGED); } RegisterEvents(controls[i]); } }