以下是引用吹水佬在2015-11-24 22:57:59的发言:
考虑换屏
of = CREATEOBJECT("form1")
of.show(1)
DEFINE CLASS form1 as Form
AutoCenter = .T.
ADD OBJECT list1 as ListBox WITH top=10,left=10,RowSourceType=1,;
RowSource="101,202,303,404,505,606,707,808,909,202,303,404,505,606,707,808,909,202,303,404,505,606,707,808,909"
PROCEDURE list1.MouseMove(nButton, nShift, nXCoord, nYCoord)
nRowHeight = FONTMETRIC(1, this.FontName, this.FontSize);
+ FONTMETRIC(3, this.FontName, this.FontSize) + 2
nRow = INT((nYCoord - this.Top - 2) / nRowHeight)
this.ListIndex = nRow + this.TopIndex
ENDPROC
ENDDEFINE
我改良了一下。
LPARAMETERS nButton, nShift, nXCoord, nYCoord
nRowHeight = FONTMETRIC(1, this.FontName, this.FontSize);
+ FONTMETRIC(3, this.FontName, this.FontSize) + 2
TopYCoord=(this.Parent.top + this.Top) &&容器Cti1+List1的高度,我的List1放在容器Cti1中
MaxXCoord=(this.Parent.left + this.left + this.Width -22) &&滚动条的宽度大概20,鼠标在滚动条区域不移动
nRow = INT((nYCoord - TopYCoord - 2) / nRowHeight)
IF nXCoord<=MaxXCoord
this.ListIndex = nRow + this.TopIndex
ENDIF
[此贴子已经被作者于2015-11-25 11:50编辑过]