I try to change the height of an HtmlElment
of a Webbrowser.Document
This is my code:
// when the element is rendered by browser
height = elem.OffsetRectangle.Height; // to get the height e.g 315
// here elem.ScrollRectangle height is the same as above
// setting it
IHTMLElement2 dom = elem.DomElement as IHTMLElement2;
dom.runtimeStyle.posHeight = height; // 315; // or
dom.runtimeStyle.height = height + "px";
// here elem.OffsetRectangle height is the same as height: 315
// but the elem.ScrollRectangle height is more 335!!!
After getting the height when I set the height to the same value (e.g 315), the offsetRectangle
height has this value, but the actual height of the element decreases (As I check it visually), the ScrollRectangle
height also changes.
Actually there is a mismatch between height I was read and the height I sat. The element has no padding or border.
What is the origin of this behavior? How can I get the height and change it or set it back to the original one with a consistent behavior?
Aucun commentaire:
Enregistrer un commentaire