vb编写的简易浏览器
vb编写的简易浏览器
2009年07月21日
其他 VB 文章 VB 小程序
23.vb编写的简易浏览器'在菜单“工程→部件”中勾选: Microsoft Internet Controls
'在窗体添加控件:WebBrowser1,Command1,Text1
'所有控件可随意放置,不用设置任何属性
Private Sub Command1_Click()
WebBrowser1.Navigate Trim(Text1.Text) '打开网页
End Sub
Private Sub Form_Load()
Me.Caption = "我的浏览器": Command1.Caption = "转到"
Text1.Text = "http://baidu.com/"
Me.Move Screen.Width * 0.05, Screen.Height * 0.05, Screen.Width * 0.9, Screen.Height * 0.9
Call Command1_Click
End Sub
Private Sub Form_Resize()
Dim W As Single, H As Single, T As Single, L As Single, S1 As Single
S1 = Me.TextWidth("A")
Command1.Move S1, S1, S1 * 8, S1 * 4
L = Command1.Left + Command1.Width + S1: W = Me.ScaleWidth - L - S1
If W > 0 Then Text1.Move L, Command1.Top + S1 * 0.5, W, S1 * 3
T = Command1.Top + Command1.Height + S1: W = Me.ScaleWidth
H = Me.ScaleHeight - T
If W > 0 And H > 0 Then WebBrowser1.Move 0, T, W, H
End Sub
其他 VB 文章 VB 小程序