首页 » VB » vb制作简单的多窗口浏览器(2)– form初始化

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

8434 4

框架都搭好了,现在开始主要是代码了.
先定义变量

    '一共打开多少页
    Dim totalpage As Integer
    '当前页
    Dim activepage As Integer
    Dim i As Integer
    '删除了多少页
    Dim delflag As Integer
    '显示多少页
    Dim display As Integer
    '按钮不闪烁
    Dim noflash As Integer

接下来是form_load

    Private Sub Form_Load()
        Dim tmpstr As String
        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.ZOrder 1
        'Picture29.ZOrder 0
        'Picture30.ZOrder 0
        StatusBar1.ZOrder 0
        ProgressBar1.ZOrder 0
        '状态栏初始化
        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)
        If tmpstr = 1 Then
            Text1.Text = "Baidu Search"
        Else
            Text1.Text = "Google Search"
        End If
        Text1.ForeColor =        
    '皮肤定义
        Skin1.LoadSkin "skin/wmac.skn"
        Skin1.ApplySkin Me.hWnd
    End Sub

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

    Private Sub Form_Resize()
        '窗口大小最小限制
        If Me.Width < 13000 Then Me.Width = 13000
        If Me.Height < 3000 Then Me.Height = 3000
        If Me.WindowState <> 1 Then
             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
             For i = 0 To totalpage - 1
                 If DoesControlExist(WebBrowser1(i)) Then
                    WebBrowser1(i).Top = 340
                    WebBrowser1(i).Width = Me.Width - 120
                    WebBrowser1(i).Height = Me.Height - 1800
                 End If
             Next
        End If
        'skin更新后需要调整
        ProgressBar1.Top = Me.Height - 800
    End Sub

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

文章评分1次,平均分5.0

本文原始地址:https://www.tiandiyoyo.com/2009/01/make-a-browser-by-vb-2/
本站所有文章,除了特别注明外,均为本站原创,转载请注明出处来自www.tiandiyoyo.com

您可能还会对以下文章感兴趣:

评论前先开启评论开关:


4 Comments

载入分页评论...