vb制作简单的多窗口浏览器(2)-- form初始化

前端之家收集整理的这篇文章主要介绍了vb制作简单的多窗口浏览器(2)-- form初始化前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

框架都搭好了,现在开始主要是代码了.

先定义变量

  1. '一共打开多少页
  2. DimtotalpageAsInteger
  3. '当前页
  4. DimactivepageAsInteger
  5. DimiAsInteger
  6. '删除了多少页
  7. DimdelflagAsInteger
  8. '显示多少页
  9. DimdisplayAsInteger
  10. '按钮不闪烁
  11. DimnoflashAsInteger

接下来是form_load

  1. PrivateSubForm_Load()
  2. DimtmpstrAsString
  3. activepage=0
  4. totalpage=1
  5. display=1
  6. SSTab1.Tabs=totalpage
  7. '页面留白
  8. WebBrowser1(activepage).Navigate"about:blank"
  9. '预设几个URL,方便测试
  10. Combo1.AddItem("www.baidu.com")
  11. Combo1.AddItem("www.google.com")
  12. Combo1.AddItem("www.17173.com")
  13. Combo1.AddItem("www.yahoo.com")
  14. Combo1.AddItem("www.sina.com")
  15. Combo1.AddItem("www.online.sh.cn")
  16. '于是几个label,方便测试
  17. Label1.Caption="总共"&totalpage&"显示"&display
  18. Label2.Caption="当前"&activepage
  19. Label3.Caption="删除"&delflag
  20. 'SSTab1.ZOrder1
  21. 'Picture29.ZOrder0
  22. 'Picture30.ZOrder0
  23. StatusBar1.ZOrder0
  24. ProgressBar1.ZOrder0
  25. '状态栏初始化
  26. StatusBar1.Panels(1).Width=7700
  27. StatusBar1.Panels(1).Bevel=sbrNoBevel
  28. StatusBar1.Panels.Add(2)
  29. StatusBar1.Panels(2).Width=1000
  30. StatusBar1.Panels(2).Bevel=sbrNoBevel
  31. StatusBar1.Panels(2).Text="当前时间:"
  32. StatusBar1.Panels.Add(3)
  33. StatusBar1.Panels(3).Width=1000
  34. StatusBar1.Panels(3).Bevel=sbrNoBevel
  35. StatusBar1.Panels(3).Style=sbrDate
  36. StatusBar1.Panels.Add(4)
  37. StatusBar1.Panels(4).Width=700
  38. StatusBar1.Panels(4).Bevel=sbrNoBevel
  39. StatusBar1.Panels(4).Style=sbrTime
  40. StatusBar1.Panels.Add(5)
  41. StatusBar1.Panels(5).Width=2700
  42. StatusBar1.Panels(5).Bevel=sbrNoBevel
  43. StatusBar1.Panels.Add(6)
  44. StatusBar1.Panels(6).Width=900
  45. 'StatusBar1.Panels(6).Bevel=sbrNoBevel
  46. StatusBar1.Panels(6).Picture=Picture29.Picture
  47. StatusBar1.Panels(6).Text="普通"
  48. '读取ini默认引擎
  49. a=ReadIni("./gr.ini","conf","searchengin",tmpstr,10)
  50. Iftmpstr=1Then
  51. Text1.Text="BaiduSearch"
  52. Else
  53. Text1.Text="GoogleSearch"
  54. EndIf
  55. Text1.ForeColor=
  56. '皮肤定义
  57. Skin1.LoadSkin"skin/wmac.skn"
  58. Skin1.ApplySkinMe.hWnd
  59. EndSub

至少这个form_load目前来说功能是够了,接下来加入form_resize

  1. PrivateSubForm_Resize()
  2. '窗口大小最小限制
  3. IfMe.Width<13000ThenMe.Width=13000
  4. IfMe.Height<3000ThenMe.Height=3000
  5. IfMe.WindowState<>1Then
  6. Combo1.Width=Me.Width-11730
  7. Picture6.Left=Me.Width-3530
  8. Text1.Left=Me.Width-3000
  9. Picture3.Left=Me.Width-800
  10. SSTab1.Width=Me.Width-120
  11. SSTab1.Height=Me.Height-1100
  12. Fori=0Tototalpage-1
  13. IfDoesControlExist(WebBrowser1(i))Then
  14. WebBrowser1(i).Top=340
  15. WebBrowser1(i).Width=Me.Width-120
  16. WebBrowser1(i).Height=Me.Height-1800
  17. EndIf
  18. Next
  19. EndIf
  20. 'skin更新后需要调整
  21. ProgressBar1.Top=Me.Height-800
  22. EndSub

PS:这里的resize不包括statusbar上的东西,因为目前正在做statusbar.

猜你在找的VB相关文章