当我的picturebox里的控件大于picturebox的大小时,我想在picturebox控件右侧和下端添加两个滚动条,以实现拖动滚动条就可以调整picturebox中控件的显示。不知该如何实现,请高人指点。
解决方案 »
- 怎样将软件一部分文件安装在系统盘的program文件夹下面
- VB6中窗体中的数值传送
- 急救啊!!!!!!!!!!!!!!!!1大送分!!!!!菜鸟问题!!!
- 救命!关于MSDN的问题!!!
- 请问哪位大虾有Explorer for SQL Server 2000的注册码??谢谢了
- 在线等答案:在一个label中的控件太多,请问如何添加滚动条?急急急
- VB新手求DAO数据库连接问题!谢谢!
- 堂堂一大国就没人能解决这问题吗? 我晕哟 SQL Server 存储过程返回结果集
- 在VB6中怎么控制打印输出?
- 有关filelistbox的问题?
- 如何通过VB自动配置ODBC
- 怎么回漏掉一位,请各位帮忙!急
我们才好给你例子程序,,,
不然又会在这里帖上一大堆代码,,,你弄起来也麻烦,别人看起来也恼火,,,
^_^,,,,,
一点建议,,不要生气,,,
imgedit1.image="e:\mc\test.jpg"
imgedit1.display
相信会有这个方面的示例程序。
一个picturebox,一个image,一个vscroll,一个hscroll,但注意image,vscroll,hscroll需以
picturebox为父(即把他们直接拖到picturebox里)Private Sub HScroll1_Change()
Image1.Left = -HScroll1.Value
End Sub
Private Sub VScroll1_Change()
Image1.Top = -VScroll1.Value
End Sub
Private Sub Form_Load()
Image1.Left = 0
Image1.Top = 0
HScroll1.SmallChange = 300
VScroll1.SmallChange = 300
HScroll1.Max = Image1.Width - Picture1.Width
VScroll1.Max = Image1.Height - Picture1.Height
HScroll1.Min = 0
VScroll1.Min = 0
End Sub
另外,也可以实现用鼠标拖动显示图片的效果。
控件 :picturebox,image(以picturebox为父)
Dim ix As Integer
Dim iy As Integer
Private Sub Form_Load()
Image1.Left = 0
Image1.Top = 0
End SubPrivate Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
ix = X
iy = Y
End If
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ipx As Integer
Dim ipy As Integer
If Button = vbLeftButton Then
ipx = Image1.Left + X - ix
ipy = Image1.Top + Y - iy
If ipx > 0 Then
Image1.Left = 0
Else
If ipx < Picture1.Width - Image1.Width Then
ipx = Picture1.Width - Image1.Width
Else
Image1.Left = ipx
End If
End If
If ipy > 0 Then
Image1.Top = 0
Else
If ipy < Picture1.Height - Image1.Height Then
ipy = Picture1.Height - Image1.Height
Else
Image1.Top = ipy
End If
End If
End If
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.MousePointer = 0
End Sub