Quantcast
Viewing all articles
Browse latest Browse all 48

Answer by LMeyer for Virtual Win8 keyboard in WebBrowser control

Finally found it here... As written, the Winforms WebBrowser has better wrapper for HTMLDocument, making it way easier than using MSHTML interop. Here's a code snippet :

C# :

public partial class BrowserWindow : Window        {            public BrowserWindow(string url)            {                InitializeComponent();                WebView.ScriptErrorsSuppressed = true;                WebView.AllowNavigation = true;                WebView.Navigate(new Uri(url));                WebView.DocumentCompleted += LoadCompleteEventHandler;            }            private void LoadCompleteEventHandler(object sender, WebBrowserDocumentCompletedEventArgs navigationEventArgs)            {                HtmlElementCollection elements = this.WebView.Document.GetElementsByTagName("input");                foreach (HtmlElement input in elements)                {                    if (input.GetAttribute("type").ToLower() == "text")                    {                        input.GotFocus += (o, args) => VirtualKeyBoardHelper.AttachTabTip();                        input.LostFocus += (o, args) => VirtualKeyBoardHelper.RemoveTabTip();                    }                }            }        }

XAML :

<Window        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"        x:Class="PlayPlatform.BrowserWindow"        Title="Browser" ResizeMode="NoResize"        WindowStartupLocation="CenterScreen" WindowState="Maximized" Topmost="True" ShowInTaskbar="False" WindowStyle="None" AllowDrop="False" AllowsTransparency="False"><WindowsFormsHost HorizontalAlignment="Stretch" VerticalAlignment="Stretch"><wf:WebBrowser x:Name="WebView" /></WindowsFormsHost></Window>

The VirtualKeyBoardHelper methods are manuallly launching and terminating tabtip.exe.


Viewing all articles
Browse latest Browse all 48

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>