VB中图片框怎么加入滚动条 50
假设一个图片框的宽度为1000,高为5000。在这个图片框里面画图。但是,只让这个图片框面积,画出其中一部分,另外的图象经过滚动条显示出来。谢谢。估计有点麻烦。。。。最好...
假设一个图片框的宽度为1000,高为5000。在这个图片框里面画图。但是,只让这个图片框面积,画出其中一部分,另外的图象经过滚动条显示出来。
谢谢。估计有点麻烦。。。。最好简要写一下代码和思路。。。。
好象看不懂! 展开
谢谢。估计有点麻烦。。。。最好简要写一下代码和思路。。。。
好象看不懂! 展开
1个回答
展开全部
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8955
ClientLeft = 60
ClientTop = 345
ClientWidth = 9870
LinkTopic = "Form1"
ScaleHeight = 8955
ScaleWidth = 9870
StartUpPosition = 3 '窗口缺省
Begin VB.VScrollBar VS1
Height = 2295
Left = 8280
TabIndex = 3
Top = 0
Width = 375
End
Begin VB.HScrollBar HS1
Height = 375
Left = 0
TabIndex = 2
Top = 7440
Width = 1455
End
Begin VB.PictureBox Pic1
Height = 7455
Left = 0
ScaleHeight = 7395
ScaleWidth = 8235
TabIndex = 0
Top = 0
Width = 8295
Begin VB.PictureBox Pic2
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 10215
Left = -120
ScaleHeight = 10185
ScaleWidth = 10425
TabIndex = 1
Top = -720
Width = 10455
Begin VB.Shape Shape3
Height = 2055
Left = 3480
Top = 3600
Width = 3135
End
Begin VB.Shape Shape2
Height = 2295
Left = 6840
Top = 7440
Width = 3255
End
Begin VB.Shape Shape1
Height = 2175
Left = 480
Top = 240
Width = 3015
End
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Pic1.Left = 0
Pic1.Top = 0
Pic1.Width = Me.Width - VS1.Width
Pic1.Height = Me.Height - HS1.Height - 450
Pic2.Left = 0
Pic2.Top = 0
Pic2.Width = Pic1.Width * 6
Pic2.Height = Pic2.Height * 6
HS1.Left = 0
HS1.Top = Me.Height - HS1.Height - 450
HS1.Width = Me.Width - VS1.Width
HS1.Min = 0
HS1.Max = 100
HS1.LargeChange = 20
HS1.SmallChange = 5
VS1.Left = Me.Width - VS1.Width
VS1.Top = 0
VS1.Height = Me.Height - 450
VS1.Min = 0
VS1.Max = 100
VS1.LargeChange = 20
VS1.SmallChange = 5
End Sub
Private Sub HS1_Change()
Pic2.Left = -(HS1.Value / HS1.Max) * (Pic2.Width - Pic1.Width)
End Sub
Private Sub VS1_Change()
Pic2.Top = -(VS1.Value / VS1.Max) * (Pic2.Height - Pic1.Height)
End Sub
你把这些复制到记事本里,取名form1.frm运行一下看看.哪不明白再问,你就说看不懂,我也不知从哪给你讲起
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8955
ClientLeft = 60
ClientTop = 345
ClientWidth = 9870
LinkTopic = "Form1"
ScaleHeight = 8955
ScaleWidth = 9870
StartUpPosition = 3 '窗口缺省
Begin VB.VScrollBar VS1
Height = 2295
Left = 8280
TabIndex = 3
Top = 0
Width = 375
End
Begin VB.HScrollBar HS1
Height = 375
Left = 0
TabIndex = 2
Top = 7440
Width = 1455
End
Begin VB.PictureBox Pic1
Height = 7455
Left = 0
ScaleHeight = 7395
ScaleWidth = 8235
TabIndex = 0
Top = 0
Width = 8295
Begin VB.PictureBox Pic2
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 10215
Left = -120
ScaleHeight = 10185
ScaleWidth = 10425
TabIndex = 1
Top = -720
Width = 10455
Begin VB.Shape Shape3
Height = 2055
Left = 3480
Top = 3600
Width = 3135
End
Begin VB.Shape Shape2
Height = 2295
Left = 6840
Top = 7440
Width = 3255
End
Begin VB.Shape Shape1
Height = 2175
Left = 480
Top = 240
Width = 3015
End
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Pic1.Left = 0
Pic1.Top = 0
Pic1.Width = Me.Width - VS1.Width
Pic1.Height = Me.Height - HS1.Height - 450
Pic2.Left = 0
Pic2.Top = 0
Pic2.Width = Pic1.Width * 6
Pic2.Height = Pic2.Height * 6
HS1.Left = 0
HS1.Top = Me.Height - HS1.Height - 450
HS1.Width = Me.Width - VS1.Width
HS1.Min = 0
HS1.Max = 100
HS1.LargeChange = 20
HS1.SmallChange = 5
VS1.Left = Me.Width - VS1.Width
VS1.Top = 0
VS1.Height = Me.Height - 450
VS1.Min = 0
VS1.Max = 100
VS1.LargeChange = 20
VS1.SmallChange = 5
End Sub
Private Sub HS1_Change()
Pic2.Left = -(HS1.Value / HS1.Max) * (Pic2.Width - Pic1.Width)
End Sub
Private Sub VS1_Change()
Pic2.Top = -(VS1.Value / VS1.Max) * (Pic2.Height - Pic1.Height)
End Sub
你把这些复制到记事本里,取名form1.frm运行一下看看.哪不明白再问,你就说看不懂,我也不知从哪给你讲起
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询