这段代码有点啰嗦:
PROCEDURE Command1.Click
FOR i = 1 TO thisform.List1.ListCount
IF thisform.List1.Selected(i)
thisform.List1.TopIndex = i
EXIT
ENDIF
ENDFOR
ENDPROC
可优化成:这样清爽多了。
PROCEDURE Command1.Click
thisform.List1.TopIndex = thisform.List1.ListIndex
ENDPROC
PROCEDURE Command1.Click
FOR i = 1 TO thisform.List1.ListCount
IF thisform.List1.Selected(i)
thisform.List1.TopIndex = i
EXIT
ENDIF
ENDFOR
ENDPROC
可优化成:这样清爽多了。
PROCEDURE Command1.Click
thisform.List1.TopIndex = thisform.List1.ListIndex
ENDPROC