Beispiel #1
0
        public void ShowKeyboard(Control control, TouchKeyboardStyle style)
        {
            CancelKeyboardEventArgs ce = new CancelKeyboardEventArgs(control, style);
            OnKeyboardOpening(ce);
            if (ce.Cancel) return;

            _CurrentTarget = ce.TargetControl;
            style = ce.Style;

            _PopupKeyboard.CurrentControl = _CurrentTarget;

            if (_CurrentTarget != null)
            {
                if (style == TouchKeyboardStyle.Floating)
                {
                    try
                    {
                        _ShowingFloatingKeyboard = true;
                        _PopupKeyboard.Owner = _CurrentTarget.FindForm();
                        _PopupKeyboard.Controls.Add(_VirtualKeyboard);
                        _VirtualKeyboard.Dock = DockStyle.Fill;
                        _VirtualKeyboard.Visible = true;
                        _PopupKeyboard.Show();

                        // When floating, don't show the top bar. The information on the top bar are on the window's title bar.
                        _VirtualKeyboard.IsTopBarVisible = false;
                    }
                    finally
                    {
                        _ShowingFloatingKeyboard = false;
                    }
                }
                else if (style == TouchKeyboardStyle.Inline)
                {
                    Form owner = _CurrentTarget.FindForm();
                    _VirtualKeyboard.Dock = Dock;
                    owner.Controls.Add(_VirtualKeyboard);
                    _VirtualKeyboard.BringToFront();
                    _VirtualKeyboard.Visible = true;

                    // When inline, show the top bar.
                    _VirtualKeyboard.IsTopBarVisible = true;
                }
            }

            OnKeyboardOpened(EventArgs.Empty);
        }
Beispiel #2
0
 /// <summary>
 /// Raises KeyboardOpening event.
 /// </summary>
 /// <param name="e">Provides event arguments.</param>
 protected virtual void OnKeyboardOpening(CancelKeyboardEventArgs e)
 {
     CancelKeyboardEventHandler handler = KeyboardOpening;
     if (handler != null)
         handler(this, e);
 }