Пример #1
0
        void Control_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            charPressed = false;
            handled     = true;
            key         = KeyMap.Convert(e.KeyCode) | KeyMap.Convert(e.Modifiers);

            if (key != Key.None)
            {
                KeyPressEventArgs kpea = new KeyPressEventArgs(key);
                Widget.OnKeyDown(kpea);
                e.Handled = kpea.Handled;
                handled   = kpea.Handled;
            }
            else
            {
                handled = false;
            }
            if (!handled && charPressed)
            {
                // this is when something in the event causes messages to be processed for some reason (e.g. show dialog box)
                // we want the char event to come after the dialog is closed, and handled is set to true!
                KeyPressEventArgs kpea = new KeyPressEventArgs(key, keyChar);
                Widget.OnKeyDown(kpea);
                e.Handled = kpea.Handled;
            }
        }
Пример #2
0
        MouseEventArgs GetMouseEvent(System.Windows.Forms.MouseEventArgs e)
        {
            Point        point   = new Point(e.X, e.Y);
            MouseButtons buttons = MouseButtons.None;

            if ((e.Button & SWF.MouseButtons.Left) != 0)
            {
                buttons |= MouseButtons.Primary;
            }
            if ((e.Button & SWF.MouseButtons.Right) != 0)
            {
                buttons |= MouseButtons.Alternate;
            }
            if ((e.Button & SWF.MouseButtons.Middle) != 0)
            {
                buttons |= MouseButtons.Middle;
            }
            Key modifiers = KeyMap.Convert(SWF.Control.ModifierKeys);

            return(new MouseEventArgs(buttons, modifiers, point));
        }
Пример #3
0
 void HandleControlMouseEnter(object sender, EventArgs e)
 {
     Widget.OnMouseEnter(new MouseEventArgs(MouseButtons.None, KeyMap.Convert(SWF.Control.ModifierKeys), Point.Empty));
 }