Webkit.net scroll document programmatically
if I use Webkit.Net to display HTML in my winforms application everytime I set the DocumentText
property, the document is scrolled back to the beginning.
How can I get the current scroll position and set it after I changed the document text?
Ok, it seems that I've overlooked the ScrollOffset
property :).
I'd like to add that it is not sufficient to set it directly after updating the DocumentText
property since webkit loads the document asyncronously. Therefore I have to intercept the DocumentCompleted
event like:
Point p;
void UpdateDocument() {
p=webkitBrowser.ScrollOffset;
webkitBrowser.DocumentText = CreateNewDocument();
}
private void webKitBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
webkitBrowser.ScrollOffset = p;
}
This works as I needed.
Thanks anyway.
精彩评论