我有一個小應用程序,它嵌入了網頁瀏覽器控件。在那個應用程序中,我創建了一個彈出式類。該彈出窗口用於顯示服務器生成的錯誤消息。渲染web瀏覽器控件離屏(或隱藏)
我想能夠調整彈出窗口來適應消息。這是一個簡短的信息不包含在一個超大的形式中,而一個大的信息不是一個小的形式。
而不是發送寬度和高度我想在飛行中計算尺寸。我也不想明顯調整表格的大小,這簡直太醜了。
一切我嘗試失敗:(
這就是我認爲應該工作
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控件拒絕渲染,所以我不能讓客戶端寬度和高度
有誰知道如何可以做到這一點?
DC
你能告訴我們你的源代碼? –
我必須建立一個模擬應用程序,目前的應用程序使用了大量的遺留代碼,只會造成更多混淆。至少你不是說它不能這樣做,這本身就是一件好事:) – DeveloperChris