关于动态拉动窗口分割线
初学VB,请不吝赐教!在主窗体中,有三个控件,左为richtextbox1,右为text1,中间image1为作为分割条。
期望在左右拖动image1时,能实时动态地改变richtextbox1和text1的区域。
运行后,有2个问题。一是在按住鼠标拖动image1时,image1在不停地闪烁;二是3个控件都没有到鼠标指针到达的地方。请问各位高手,我这种设计思路合适吗?如合适,问题出在哪里?
Dim mdown As Boolean
Dim p1, p2, p3 As Single
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
p1 = Image1.Left
p2 = Text1.Left
p3 = RichTextBox1.Width
Image1.Visible = True
mdown = True
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If mdown = True Then
Text1.Left = p2 + X
Image1.Left = p1 + X
RichTextBox1.Width = p3 + X
End If
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
mdown = False
Image1.Visible = False
End Sub