Пример #1
0
        public static void SetupCallbacks(Control control, MyTextBox textBox)
        {
            MouseEventHandler    MouseDown  = (a, args) => textBox.MouseDown(args);
            MouseEventHandler    MouseUp    = (a, args) => textBox.MouseUp(args);
            MouseEventHandler    MouseMove  = (a, args) => textBox.MouseMove(args);
            MouseEventHandler    MouseClick = (a, args) => textBox.MouseClick(args);
            KeyPressEventHandler KeyPress   = (a, args) => textBox.KeyPress(args);
            KeyEventHandler      KeyDown    = (a, args) => textBox.KeyDown(args);
            PaintEventHandler    Paint      = (a, args) => textBox.Paint(args.Graphics);
            EventHandler         GotFocus   = (a, args) => textBox.GotFocus();
            EventHandler         LostFocus  = (a, args) => textBox.LostFocus();

            control.MouseDown  += MouseDown;
            control.MouseUp    += MouseUp;
            control.MouseMove  += MouseMove;
            control.MouseClick += MouseClick;
            control.KeyPress   += KeyPress;
            control.KeyDown    += KeyDown;
            control.Paint      += Paint;
            control.GotFocus   += GotFocus;
            control.LostFocus  += LostFocus;

            textBox.PushDisposeActions(() =>
            {
                control.MouseDown  -= MouseDown;
                control.MouseUp    -= MouseUp;
                control.MouseMove  -= MouseMove;
                control.MouseClick -= MouseClick;
                control.KeyPress   -= KeyPress;
                control.KeyDown    -= KeyDown;
                control.Paint      -= Paint;
                control.GotFocus   -= GotFocus;
                control.LostFocus  -= LostFocus;
            });
        }
Пример #2
0
 public override void MouseUp(MouseEventArgs args)
 {
     StopTimers();
     if (m_textBox.Area.Contains(args.Location))
     {
         m_textBox.MouseUp(args);
     }
 }