public void OnMessage(ref Message m) { // We want these messages to go through the designer's WndProc method, and we want people to be able // to do default processing with the designer's DefWndProc. So, we stuff ourselves into the designers // window target and call their WndProc. ControlDesigner currentDesigner = _designer; if (currentDesigner != null) { IDesignerTarget designerTarget = currentDesigner.DesignerTarget; currentDesigner.DesignerTarget = this; try { currentDesigner.WndProc(ref m); } catch (Exception ex) { currentDesigner.SetUnhandledException(currentDesigner.Control, ex); } finally { currentDesigner.DesignerTarget = designerTarget; } } else { DefWndProc(ref m); } }