'初始化
Private Sub Form_Load()VScroll1.Max = Picture1.Height - Picture1.Height
HScroll1.Max = Picture1.Width - Picture1.Width
End Sub
'横向滚动
Private Sub HScroll1_Change()
Picture1.Left = -HScroll1.Value
End Sub
'纵向滚动
Private Sub VScroll1_Change()
Picture1.Top = -VScroll1.Value
End SubPrivate Sub Picture1_Click()
Picture1.Picture = LoadPicture()
If Picture1.Height > Picture2.Height Then
VScroll1.Visible = True
Else
VScroll1.Visible = False
End If
End Sub
Private Sub Form_Load()VScroll1.Max = Picture1.Height - Picture1.Height
HScroll1.Max = Picture1.Width - Picture1.Width
End Sub
'横向滚动
Private Sub HScroll1_Change()
Picture1.Left = -HScroll1.Value
End Sub
'纵向滚动
Private Sub VScroll1_Change()
Picture1.Top = -VScroll1.Value
End SubPrivate Sub Picture1_Click()
Picture1.Picture = LoadPicture()
If Picture1.Height > Picture2.Height Then
VScroll1.Visible = True
Else
VScroll1.Visible = False
End If
End Sub
解决方案 »
- 如何为自定义控件加属性?
- 怎样把SQL SERVER数据库的内容导入到记事本里
- Components中添加一个控件,说File Format no longer supported。在线等候......
- 如何用SQL语句实现一个客户一段时间的应收帐款的统计??急死人了....
- ■·■200分恭送Pigpag!!!!!!■·■
- VBS如何查找文档中某个特定的字符有多少个,请赐教谢谢
- 用ASP实现图片上传,代码怎么写?
- 请问:怎么使frame背景透明化?
- 能否将您的SPREAD 3.0 发到[email protected] 信箱中,非常感谢!!
- 屏幕的分辨率问题(急!)
- 紧急求助VB高手!
- 关于DLL的问题
Dim n As String
Picture2.AutoSize = True
Picture2.Top = 0
Picture2.Left = 0
n = InputBox("Path" + Chr(10) + " D:\Big Sky.tif" + Chr(13) + " D:\Rose.bmp", , "D:\key.bmp")
Picture2.Picture = LoadPicture(n)
HScroll1.Visible = False
VScroll1.Visible = False
If Picture2.Width - Picture1.Width > 0 Then
HScroll1.Visible = True
'HScroll1.Enabled = True
HScroll1.LargeChange = Int((Picture2.Width - Picture1.Width) / 10)
HScroll1.SmallChange = Int((Picture2.Width - Picture1.Width) / 100)
Else
HScroll1.Visible = False
'HScroll1.Enabled = False
End If
If Picture2.Height - Picture1.Height > 0 Then
VScroll1.Visible = True
'VScroll1.Enabled = True
VScroll1.LargeChange = Int((Picture2.Height - Picture1.Height) / 10)
VScroll1.SmallChange = Int((Picture2.Height - Picture1.Height) / 100)
Else
VScroll1.Visible = False
'VScroll1.Enabled = False
End If
HScroll1.Max = Picture2.Width - Picture1.Width
VScroll1.Max = Picture2.Height - Picture1.Height
End Sub
Private Sub HScroll1_Scroll()
Picture2.Left = -HScroll1.Value
End Sub
Private Sub VScroll1_Scroll()
Picture2.Top = -VScroll1.Value
End Sub
Private Sub HScroll1_Change() Picture2.Left = -HScroll1.Value
End Sub
Private Sub VScroll1_Change() Picture2.Top = -VScroll1.Value
End Sub