【发布时间】:2010-02-21 01:39:06
【问题描述】:
我有一个嵌入 webbrowser 控件的小型应用程序。在那个应用程序中,我创建了一个弹出类。此弹出窗口用于显示服务器生成的错误消息。
我希望能够调整弹出窗口的大小以适应消息。这样一来,短消息不包含在过大的表单中,而大消息不包含在过小的表单中。
我想即时计算尺寸,而不是发送宽度和高度。我也不想明显地调整表单的大小,那太丑了。
我尝试的一切都失败了:(
这是我认为应该起作用的
create the form
move it offscreen by setting its left position to -1000
show the form (offscreen)
write the contents to the webrowser ctl
get the width and height after it renders
hide the form
resize the form to fit the above width and height
center it onscreen
show the form
这应该很好用,除了 webbrowser 控件拒绝呈现,因此我无法获取客户端宽度和高度
有谁知道如何做到这一点?
直流
【问题讨论】:
-
你能告诉我们你的源代码吗?
-
我必须建立一个模拟应用程序,当前的应用程序使用了很多遗留代码,只会造成更多的混乱。至少你不是说它不能这样做,所以它本身就是一件好事:)
标签: c# .net c++ com webbrowser-control