protected override void OnKeyPress(KeyPressEventArgs e) { WindowlessControlHost host = this; while (host != null) { host.OnWindowlessKeyPress(this, e); host = host.Parent as WindowlessControlHost; } base.OnKeyPress(e); }
static void Control_KeyPress(object sender, KeyPressEventArgs e) { Control control = FindFocusedControl(sender as Control); if (control is WindowlessControlHost) { return; } Control parent = control; while (parent != null) { WindowlessControlHost host = parent as WindowlessControlHost; if (host != null) { host.OnWindowlessKeyPress(control, e); } parent = parent.Parent; } }