开发者

Automatically resize ActiveX object in browser

开发者 https://www.devze.com 2023-03-27 07:02 出处:网络
I\'m programming activex component and adding it to html with object-tag. Is there a way to modify the height of this compon开发者_如何学Pythonent dynamically, based on the contents (of activex)? Shou

I'm programming activex component and adding it to html with object-tag. Is there a way to modify the height of this compon开发者_如何学Pythonent dynamically, based on the contents (of activex)? Should I somehow call javascript code from inside c++ code, and ask javascript to resize object-element using DOM?


That would probably be the easiest way to do it; You can find out how to get a IHtmlElement reference to your object tag here: How to get a IHTMLElement pointer to the <object> tag hosting an activex control

You should then be able to set the width and height. Another (easier) option would be to set the width and height of your activex control to 100% and put it inside a div; then pass the id of the div into your activex control and use that to get the element by ID and resize that. Sometimes modifying the size of an object tag can act in unexpected ways.

FireBreath would abstract a lot of this for you and make it work on other browsers in addition; is there a reason you're doing this all by hand?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号