| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1256 人关注过本帖
标题:Textbox+listbox组成的动态列表
只看楼主 加入收藏
mywisdom88
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:191
帖 子:3146
专家分:8408
注 册:2015-3-25
收藏
得分:0 
以下是引用吹水佬在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编辑过]

2015-11-25 11:48
tack
Rank: 1
等 级:新手上路
帖 子:24
专家分:3
注 册:2015-12-22
收藏
得分:0 
楼主,成品放一个上来,谢谢
2016-05-11 08:26
快速回复:Textbox+listbox组成的动态列表
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017148 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved