Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void WbrBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
- {
- HtmlElementCollection Elements = wbrBrowser.Document.Body.All;
- foreach (HtmlElement elem in Elements)
- {
- elem.DoubleClick += new HtmlElementEventHandler(WbrBrowser_MouseDoubleClick);
- }
- }
- private void WbrBrowser_MouseDoubleClick(object sender, HtmlElementEventArgs e)
- {
- rtbTextEditor.SelectionStart = 0;
- HtmlElement elem = (HtmlElement)sender;
- rtbTextEditor.Focus();
- string start = elem.InnerText;
- if (wbrBrowser.DocumentText.IndexOf(start) == -1)//not found
- {
- rtbUserTextEditorOnlyText.Text = @"String not found in: " + elem.TagName;
- }
- else
- {
- rtbTextEditor.SelectionStart = wbrBrowser.DocumentText.IndexOf(start);
- }
- }
- <html>
- <head>
- <title>IntroPage editing page</title>
- <body>
- <h1 id ="testing">Wanna change this! Now here is some text to try some different things with.</h1>
- <div>Hello from DIV</div><p>So here is another element, a "p" element, let's try to make this a little more generic..
- </p>
- </body>
- </head>
- </html>
Add Comment
Please, Sign In to add comment