コード例 #1
0
        }   // end of LostFocus()

        public static void ShowOnScreenKeyboard()
        {
#if NETFX_CORE
            VirtualKeyboard.Activate();
            //Debug.Assert(false, "Is this needed for Win8?");
#else
            try
            {
                Process tabTip = new Process();
                tabTip.StartInfo.FileName        = "C:\\Program Files\\Common Files\\Microsoft Shared\\ink\\TabTip";
                tabTip.StartInfo.UseShellExecute = true;
                tabTip.Start();
            }
            catch (Win32Exception e)
            {
                Debug.WriteLine("Could not show keyboard. NativeErrorCode: " + e.NativeErrorCode);

                //If this fail we could fall back to the on screen keyboard
                try
                {
                    Process oskProcess = new Process();
                    oskProcess.StartInfo.UseShellExecute = true;
                    oskProcess.StartInfo.FileName        = @"c:\WINDOWS\system32\osk";
                    oskProcess.Start();
                }
                catch (Win32Exception exception)
                {
                    //If this fail we could fall back to the on screen keyboard for Win7

                    Debug.WriteLine("Could not show OSK keyboard. NativeErrorCode: " + exception.NativeErrorCode);
                }
            }
#endif
        }