// Inicia o período de gravação de eventos
        public void StartRecorder()
        {
            foreach (Control control in theOriginalForm.Controls)
            {
                foreach (var evento in control.GetType().GetEvents())
                {
                    Type t = evento.EventHandlerType;

                    MyEventClass x = new MyEventClass(evento.Name);


                    var minfo = x.GetType().GetMethod("MyEvent");
                    if (minfo != null)
                    {
                        if (dic.ContainsKey(evento.EventHandlerType.Name))
                        {
                            Delegate toAdd = Delegate.CreateDelegate(evento.EventHandlerType, dic[evento.EventHandlerType.Name],
                                                                     dic[evento.EventHandlerType.Name].GetType().GetMethod("MyEvent"));
                            evento.AddEventHandler(control, toAdd);
                        }
                        else
                        {
                            Delegate toAdd = Delegate.CreateDelegate(evento.EventHandlerType, x, minfo);
                            evento.AddEventHandler(control, toAdd);
                            dic.Add(evento.EventHandlerType.Name, x);
                        }
                    }

                    //evento.AddEventHandler(evento,
                    //evento.GetAddMethod().Invoke(control,new object[]{new EventArgs()});
                }
            }
        }
        // Inicia o período de gravação de eventos
        public void StartRecorder()
        {
            foreach (Control control in theOriginalForm.Controls)
            {
                foreach (var evento in control.GetType().GetEvents())
                {
                    Type t = evento.EventHandlerType;

                    MyEventClass x = new MyEventClass(evento.Name);


                    var minfo = x.GetType().GetMethod("MyEvent");
                    if (minfo != null)
                    {

                        if (dic.ContainsKey(evento.EventHandlerType.Name))
                        {
                            Delegate toAdd = Delegate.CreateDelegate(evento.EventHandlerType, dic[evento.EventHandlerType.Name],
                                dic[evento.EventHandlerType.Name].GetType().GetMethod("MyEvent"));
                            evento.AddEventHandler(control, toAdd);
                        }
                        else
                        {
                            Delegate toAdd = Delegate.CreateDelegate(evento.EventHandlerType, x, minfo);
                            evento.AddEventHandler(control, toAdd);
                            dic.Add(evento.EventHandlerType.Name, x);
                        }
                    }

                    //evento.AddEventHandler(evento,
                    //evento.GetAddMethod().Invoke(control,new object[]{new EventArgs()});

                }
            }
        }