以编程方式突出显示(DOM)树节点click事件上的HTML元素 [英] programmatically highlight HTML element on (DOM) tree node click event

查看:88
本文介绍了以编程方式突出显示(DOM)树节点click事件上的HTML元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何基于DOM树节点单击事件来突出显示HTML元素吗?

...我有一个Web浏览器控件和一个Treeview控件...加载网站后,我创建了该网站的HTML DOM树表示形式...

我现在要执行的操作如下:

将鼠标悬停在任何HTML元素上,然后将在HTML DOM树上选择相应的树节点,然后选择相反的方向,选择任何树节点,并用红色边框/框突出显示相应的HTML元素(类似于FireBug的功能)

我一直在互联网上寻找任何... ...任何类型的帮助,但都只是无奈而已

我真的很感谢任何帮助...

Does anyone know how to highlight an HTML element based on a DOM tree node click event...

...I have a webbrowser control & a treeview control...once I load a website I create a HTML DOM tree representation of the website...

What I want to do now, is the following:

mouse over any HTML element, which will then select the corresponding tree node on the HTML DOM Tree and the reverse, select any tree node and have the corresponding HTML element highlighted with a red border/box drawn around it (much like how FireBug functions)

I''ve been looking all over the internet for any... ...ANY type of help but have been coming away with just pure frustration

I would really appreciate any kind of help...

推荐答案

实际上,它并不像看起来那样难.使用IHTMLDocument2作为根目录,您可以插入绘制突出显示所需的任何html.是的,您将通过插入更多html来影响DOM树,但请使其远离可见的DOM树.

我建议您首先使用JavaScript开发html元素的选择,然后将其转换为C ++.
Actually it''s not really as hard as it might look. Using IHTMLDocument2 as a root you can insert whatever html is necessary to draw the highlighting. Yes, you will affect the DOM tree by inserting even more html, but keep that away from your visible DOM tree.

I recommend you develop the selection of html elements using JavaScript to begin with, and then translate into C++.


这篇关于以编程方式突出显示(DOM)树节点click事件上的HTML元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆