'分割區的寬度
PrivateConstSPLITTERWIDTH=45
'最小移動寬度
PrivateConstHMIN=15
'picLeft和picRight的寬度相對於窗體的比例
PrivatePercentAsSingle
'正在拖動的標志
PrivateDragFlagAsBoolean
'每次拖動後需要重排窗體上的控件
PrivateSubRedrawMe()
DimNewWidthAsSingle
'忽略窗體縮小的情況
IfWindowState=vbMinimizedThenExitSub
NewWidth=(ScaleWidth-SPLITTERWIDTH)*Percent
Picleft.Move0,0,NewWidth,ScaleHeight
Picright.MoveNewWidth SPLITTERWIDTH,0,ScaleWidth-NewWidth-SPLITTERWIDTH,ScaleHeight
EndSub
PrivateSubForm_Load()
'PicLeft和PicRight的MousePointer=1
Percent=0.5
EndSub
PrivateSubForm_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
DragFlag=True
EndSub
PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
'定義鼠標為vbSizeWE型
MousePointer=vbSizeWE
Percent=X/ScaleWidth
RedrawMe
EndSub
PrivateSubForm_MouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
DragFlag=False
MousePointer=0'此行語句實際沒有起作用
EndSub->