框架都搭好了,现在开始主要是代码了.
先定义变量
接下来是form_load
- PrivateSubForm_Load()
- DimtmpstrAsString
- activepage=0
- totalpage=1
- display=1
- SSTab1.Tabs=totalpage
- '页面留白
- WebBrowser1(activepage).Navigate"about:blank"
- '预设几个URL,方便测试
- Combo1.AddItem("www.baidu.com")
- Combo1.AddItem("www.google.com")
- Combo1.AddItem("www.17173.com")
- Combo1.AddItem("www.yahoo.com")
- Combo1.AddItem("www.sina.com")
- Combo1.AddItem("www.online.sh.cn")
- '于是几个label,方便测试
- Label1.Caption="总共"&totalpage&"显示"&display
- Label2.Caption="当前"&activepage
- Label3.Caption="删除"&delflag
- 'SSTab1.ZOrder1
- 'Picture29.ZOrder0
- 'Picture30.ZOrder0
- StatusBar1.ZOrder0
- ProgressBar1.ZOrder0
- '状态栏初始化
- StatusBar1.Panels(1).Width=7700
- StatusBar1.Panels(1).Bevel=sbrNoBevel
- StatusBar1.Panels.Add(2)
- StatusBar1.Panels(2).Width=1000
- StatusBar1.Panels(2).Bevel=sbrNoBevel
- StatusBar1.Panels(2).Text="当前时间:"
- StatusBar1.Panels.Add(3)
- StatusBar1.Panels(3).Width=1000
- StatusBar1.Panels(3).Bevel=sbrNoBevel
- StatusBar1.Panels(3).Style=sbrDate
- StatusBar1.Panels.Add(4)
- StatusBar1.Panels(4).Width=700
- StatusBar1.Panels(4).Bevel=sbrNoBevel
- StatusBar1.Panels(4).Style=sbrTime
- StatusBar1.Panels.Add(5)
- StatusBar1.Panels(5).Width=2700
- StatusBar1.Panels(5).Bevel=sbrNoBevel
- StatusBar1.Panels.Add(6)
- StatusBar1.Panels(6).Width=900
- 'StatusBar1.Panels(6).Bevel=sbrNoBevel
- StatusBar1.Panels(6).Picture=Picture29.Picture
- StatusBar1.Panels(6).Text="普通"
- '读取ini默认引擎
- a=ReadIni("./gr.ini","conf","searchengin",tmpstr,10)
- Iftmpstr=1Then
- Text1.Text="BaiduSearch"
- Else
- Text1.Text="GoogleSearch"
- EndIf
- Text1.ForeColor=
- '皮肤定义
- Skin1.LoadSkin"skin/wmac.skn"
- Skin1.ApplySkinMe.hWnd
- EndSub
至少这个form_load目前来说功能是够了,接下来加入form_resize
- PrivateSubForm_Resize()
- '窗口大小最小限制
- IfMe.Width<13000ThenMe.Width=13000
- IfMe.Height<3000ThenMe.Height=3000
- IfMe.WindowState<>1Then
- Combo1.Width=Me.Width-11730
- Picture6.Left=Me.Width-3530
- Text1.Left=Me.Width-3000
- Picture3.Left=Me.Width-800
- SSTab1.Width=Me.Width-120
- SSTab1.Height=Me.Height-1100
- Fori=0Tototalpage-1
- IfDoesControlExist(WebBrowser1(i))Then
- WebBrowser1(i).Top=340
- WebBrowser1(i).Width=Me.Width-120
- WebBrowser1(i).Height=Me.Height-1800
- EndIf
- Next
- EndIf
- 'skin更新后需要调整
- ProgressBar1.Top=Me.Height-800
- EndSub
PS:这里的resize不包括statusbar上的东西,因为目前正在做statusbar.
原文链接:https://www.f2er.com/vb/263344.html