艾希觅心女王皮肤:两道VB(Vissual Basic)问题,大家来帮忙

来源:百度文库 编辑:高考问答 时间:2024/04/29 21:18:11
1、窗体上有一个图片框,装入一个图片(图片图 片框大),如何操作使窗体运行时,图片框有滚动条,使用滚动条时,图片跟着一起动。

2、四个单选按钮,分别命名北京、上海、火车、汽车,再画一个文本框。当选择北京、汽车时,文本框显示“从天津到北京坐汽车”;当选择上海、火车时,文本框显示“从天津到上海坐火车”。

偶,不是高手.以下都我自己做的

1,加个picturebox,里面装个Imagebox,
pic的设置滚动条,绑定内部image位置.

2--------------以下保存为form1.frm

VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4995
ClientLeft = 60
ClientTop = 345
ClientWidth = 5280
LinkTopic = "Form1"
ScaleHeight = 4995
ScaleWidth = 5280
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text4
Height = 615
Left = 3000
TabIndex = 15
Text = "Text4"
Top = 2400
Visible = 0 'False
Width = 1215
End
Begin VB.TextBox Text3
Height = 615
Left = 1560
TabIndex = 14
Text = "Text3"
Top = 2400
Visible = 0 'False
Width = 975
End
Begin VB.TextBox Text2
Height = 615
Left = 240
TabIndex = 13
Text = "Text2"
Top = 2400
Visible = 0 'False
Width = 975
End
Begin VB.Frame Frame2
Caption = "Frame2"
Height = 2175
Left = 3120
TabIndex = 8
Top = 120
Width = 1575
Begin VB.OptionButton Option5
Caption = "5"
Height = 495
Left = 120
TabIndex = 12
Top = 120
Width = 1335
End
Begin VB.OptionButton Option6
Caption = "6"
Height = 495
Left = 120
TabIndex = 11
Top = 600
Width = 1335
End
Begin VB.OptionButton Option7
Caption = "7"
Height = 495
Left = 120
TabIndex = 10
Top = 1080
Width = 1335
End
Begin VB.OptionButton Option8
Caption = "8"
Height = 495
Left = 120
TabIndex = 9
Top = 1560
Width = 1335
End
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 2175
Left = 120
TabIndex = 3
Top = 0
Width = 1095
Begin VB.OptionButton Option1
Caption = "1"
Height = 495
Left = 120
TabIndex = 7
Top = 240
Width = 735
End
Begin VB.OptionButton Option2
Caption = "2"
Height = 495
Left = 120
TabIndex = 6
Top = 720
Width = 735
End
Begin VB.OptionButton Option3
Caption = "3"
Height = 495
Left = 120
TabIndex = 5
Top = 1200
Width = 735
End
Begin VB.OptionButton Option4
Caption = "4"
Height = 495
Left = 120
TabIndex = 4
Top = 1680
Width = 735
End
End
Begin VB.OptionButton Option10
Caption = "h"
Height = 495
Left = 1320
TabIndex = 2
Top = 1080
Width = 1335
End
Begin VB.OptionButton Option9
Caption = "q"
Height = 495
Left = 1320
TabIndex = 1
Top = 600
Width = 1335
End
Begin VB.TextBox Text1
Height = 495
Left = 240
TabIndex = 0
Text = "Text1"
Top = 3600
Width = 4095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Option1_Click()
Text2 = Option1.Caption
End Sub

Private Sub Option2_Click()
Text2 = Option2.Caption
End Sub

Private Sub Option3_Click()
Text2 = Option3.Caption
End Sub

Private Sub Option4_Click()
Text2 = Option4.Caption
End Sub
Private Sub Option5_Click()
Text4 = Option5.Caption
End Sub

Private Sub Option6_Click()
Text4 = Option6.Caption
End Sub

Private Sub Option7_Click()
Text4 = Option7.Caption
End Sub

Private Sub Option8_Click()
Text4 = Option8.Caption
End Sub
Private Sub Option9_Click()
Text3 = Option9.Caption
End Sub

Private Sub Option10_Click()
Text3 = Option10.Caption
End Sub

Private Sub Text2_Change()
Text1 = "从" + Text2 + "乘坐" + Text3 + "到" + Text4
End Sub

Private Sub Text3_Change()
Text1 = "从" + Text2 + "乘坐" + Text3 + "到" + Text4
End Sub

Private Sub Text4_Change()
Text1 = "从" + Text2 + "乘坐" + Text3 + "到" + Text4
End Sub