All pastes #525907 Raw Edit

Something

public text v1 · immutable
#525907 ·published 2007-05-31 16:10 UTC
rendered paste body
using System;
using System.Windows.Forms;

class MyRedirecter : Control {
        Control dst;
        public MyRedirecter (Control dst) {
                this.dst = dst;
        }
        protected override void OnEnter (EventArgs e) {
                Console.WriteLine (Environment.StackTrace);
                base.OnEnter (e);
                dst.Focus();
        }
}

class MyControl : Control {
        protected override void OnEnter (EventArgs e) {
                Console.WriteLine (Environment.StackTrace);
                base.OnEnter (e);
        }
}

class Test : Form {
        public Test ()
        {
                Control c = new MyControl ();
                MyRedirecter r = new MyRedirecter (c);

                Controls.Add (r);
                Controls.Add (c);
        }

        public static void Main (string[] args) {
                Application.Run (new Test());
        }
}