scroll an element into view
Posted on 2006-06-14
I have a CHtmlView window which displays an HTML page. I need to ensure that an element is in view. If it is already in view, I don't want the display to jump around. If it is not in view, it should be scrolled into view.
The last requirement is easy with IHTMLELEMENT's ScrollIntoView function. However, I can't use this all the time because it looks jumpy. I only want to use it when I really need to.
I can already get element coordinates, that's no problem. But, my question is, how can I tell what portion of the HTML page is being shown in the view? I've tried getting ScrollInfo and ScrollBarInfo etc, all with no luck.