delphi有专门的控件实现
vb 麻烦点
如两边的是两个picturebox那中间可拉动部分可以一个label控件
原理是让两边的picturebox的大小随着label在鼠标的控制移动下改变大小
参考代码:
dim canmove
dim startx
dim startyPrivate Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If vbRightButton <> 0 Then
startx = X
canmove = True
End If
End SubPrivate Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If canmove Then
If vbRightButton <> 0 Then
Label1.Left = Label1.Left + X - startx
On Error Resume Next
With Picture1
.Width = .Width + X - startx
End With
On Error Resume Next
With Picture2
.Width = .Width - X + startx
.Left = Picture1.Width + Label1.Width
End With
End If
End If
End SubPrivate Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
canmove = False
End Sub
vb 麻烦点
如两边的是两个picturebox那中间可拉动部分可以一个label控件
原理是让两边的picturebox的大小随着label在鼠标的控制移动下改变大小
参考代码:
dim canmove
dim startx
dim startyPrivate Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If vbRightButton <> 0 Then
startx = X
canmove = True
End If
End SubPrivate Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If canmove Then
If vbRightButton <> 0 Then
Label1.Left = Label1.Left + X - startx
On Error Resume Next
With Picture1
.Width = .Width + X - startx
End With
On Error Resume Next
With Picture2
.Width = .Width - X + startx
.Left = Picture1.Width + Label1.Width
End With
End If
End If
End SubPrivate Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
canmove = False
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货