/// <summary> /// /// </summary> /// <param name="control"></param> public void Detach(ComboBox control) { if (control == null) { throw new ArgumentNullException("control"); } MessageHook.UnSubclass(control.Parent.Handle, Callback); Handle = IntPtr.Zero; }
/// <summary> /// /// </summary> /// <param name="handle"></param> /// <param name="callback"></param> public static void Subclass(IntPtr handle, WndProcCallback callback) { MessageHook messageHook; if (Hooks.TryGetValue(handle, out messageHook)) { messageHook.AddHook(callback); } else { messageHook = new MessageHook(handle); Hooks[handle] = messageHook; messageHook.AddHook(callback); } }
/// <summary> /// /// </summary> /// <param name="control"></param> public void Attach(ComboBox control) { if (control == null) { throw new ArgumentNullException("control"); } if (Handle != IntPtr.Zero) { throw new InvalidOperationException("behavior is attached"); } Handle = control.Handle; MessageHook.Subclass(control.Parent.Handle, Callback); }