VB 谜案!!!!!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/05/16 15:56:45
在窗体上有五个WebBrowser控件,分别是WebCao、WebHou、WebJi、WebTang、WebMao。我想让这几个控件布局成这个样子。如图:http://hiphotos.baidu.com/zz396988160/pic/item/e55175f3436bdcd50b46e044.jpg
?v=1但是只有当窗体大小特定时才会有这种效果。改变下窗体大小,显示效果就变了,比如变成这样:http://hiphotos.baidu.com/zz396988160/pic/item/9bacaecaee69ad58f31fe745.jpg
?v=1谁能解释这是为什么?以下为代码:Private Sub Form_Resize()Dim PHeight As IntegerDim PWidth As IntegerPHeight = Form1.ScaleHeight / 2PWidth = Form1.ScaleWidth / 3WebCao.Top = 0WebCao.Left = 0WebCao.Height = PHeight - 10WebCao.Width = PWidth * 2 - 10WebHou.Top = 0WebHou.Left = PWidth * 2WebHou.Height = PHeight - 10WebHou.Width = PWidthWebJi.Top = PHeightWebJi.Left = PWidth * 2WebJi.Height = PHeightWebJi.Width = PWidthWebTang.Top = PHeightWebTang.Left = PWidthWebTan

O(∩_∩)O哈哈~,真简单

是要让随着窗口大小改变吗?
你把坐标设为屏幕窗口的坐标就可以了。

Private Sub Form_Load()
TT = WebCao.Top
TL = WebCao.Left
TW = WebCao.Width
TH = WebCao.Height

CT = WebHou.Top
CL = WebHou.Left
CW = WebHou.Width
CH = WebHou.Height

LT = WebJi.Top
LL = WebJi.Left
LW = WebJi.Width
LH = WebJi.Height

CMT = WebTang.Top
CML = WebTang.Left
CMW = WebTang.Width
CMH = WebTang.Height

CCT = WebMao.Top
CCL = WebMao.Left
CCW = WebMao.Width
CCH = WebMao.Height

End Sub

Private Sub Form_Resize()
Form1.ScaleHeight = 1000
Form1.ScaleWidth = 1000
WebCao.Top = TT
WebCao.Left = TL
WebCao.Width = TW
WebCao.Height = TH

WebJi.Top = LT
WebJi.Left = LL
WebJi.Width = LW
WebJi.Height =