What is the most simple and visually good way to imitate html elements selection like in winform designer?

StackOverflow https://stackoverflow.com/questions/23314816

  •  10-07-2023
  •  | 
  •  

Question

I doing kind of special purpose html editor. I have an TreeView of html tags hierarchy on the page. I want to make html elements selection when I change selected node in TreeView. For example, if I selected div or table or button in TreeView, I want to make that element look like selected on the page shown right near TreeView.

How could I do that? Changing element bgcolor is kinda not good in rare cases, when element do not support it. Would be perfect to show bold rectangle around selected element, but I don't know how.

I know how to invoke JS from WebBrowser, I ask about JS solution. Some ideas for what function like that would do:

function SelectObject(element_id)
{

}

I want smething like that: enter image description here

Was it helpful?

Solution

If you're happy with background color change, use it. For elements which does not "support" background change, use element-type-specific thing, which you can implement later.

Or, you should use an overlay. There's an article how to find out position of elements http://www.codeproject.com/Articles/35737/Absolute-Position-of-a-DOM-Element

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top