609
社区成员
发帖
与我相关
我的任务
分享
在pb数据窗口实现选中多行数据
long l_lastrow=1 //声明实例变量并置初值(上次点击行)
datawindow的click事件代码:
long i
if keydown(keyshift!) then //如果按下Shift键
if row>l_lastrow then
for i=l_lastrow to row
this.selectrow(i,true) //选中当前行和上次单击行之间的所有数据行
next
else
for i=l_lastrow to row step -1
this.selectrow(i,true) //选中当前行和上次单击行之间的所有数据行
next
end if
elseif keydown(keycontrol!) then //如果按下Ctrl键
if this.isselected(row) then //如果当前行被选中
this.selectrow(row,false) //取消选中该行
else
this.selectrow(row,true) //选中该行
end if
else //没有功能键按下
for i=1 to this.rowcount()
this.selectrow(i,false) //取消所有数据行选中
next
l_lastrow=row //将当前行号赋给实例变量l_lastrow
this.selectrow(row,true) //选中当前行
end if