Bonjour, j'ai un webBrowser auquel j'ajoute un tableau, mais le problème est qu'il s'ajoute à chaque fois à la fin, comment puis-je savoir où le pointeur clignotant est lorsque j'ajoute mon tableau? Et comment faire ensuite?
Merci d'avance.
Bonjour, j'ai un webBrowser auquel j'ajoute un tableau, mais le problème est qu'il s'ajoute à chaque fois à la fin, comment puis-je savoir où le pointeur clignotant est lorsque j'ajoute mon tableau? Et comment faire ensuite?
Merci d'avance.
J'ai trouvé :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 IHTMLDocument2 document = (IHTMLDocument2)webBrowser1.Document.DomDocument; IHTMLTxtRange range = (IHTMLTxtRange)document.selection.createRange(); range.text = webBrowser1.DocumentText; IHTMLTextRangeMetrics metrics = (IHTMLTextRangeMetrics)range; Point clientLocation = new Point(metrics.boundingLeft - 1, 0); HtmlElement element = webBrowser1.Document.GetElementFromPoint(clientLocation); String avant = element.InnerHtml.Substring(0, element.InnerHtml.IndexOf("<!DOCTYPE")); String partie1 = avant.Substring(0, avant.LastIndexOf("<TR")) + "<TR style=\"" + uc.Ligne + "\""; int a = avant.LastIndexOf("<TR"); int b = avant.LastIndexOf("<TD"); String partie2 = avant.Substring(avant.LastIndexOf("<TR") + 3, avant.LastIndexOf("<TD") - avant.LastIndexOf("<TR") - 3) + "<TD style=\"" + uc.Cellule + "\""; String partie3 = avant.Substring(avant.LastIndexOf("<TD") + 3); int i = element.InnerHtml.LastIndexOf("/HTML><BR>"); int j = element.InnerHtml.Length; avant = partie1 + partie2 + partie3; String après = element.InnerHtml.Substring(i + 13, j - i - 13); webBrowser1.Document.Body.InnerHtml = avant + après;
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager