该项功能是在数据窗口的单击事件中实现。
(P11.5中调试通过)
程序分析:
1、首先定义整型实例变量prerow记录按住Ctrl键和Shift键时点击的行号。
2、根据不同的按键执行不同的操作。
具体代码如下:
/*===================================*
↓↓ 多选功能 ↓↓
*===================================*/
// 临时记录行号
long temprow
if row <> 0 then // 只有点击行时执行下面操作
if keyDown(KeyControl!) then // 按下“Ctrl”键时
if isselected(row) then
SelectRow (row, false)
else
selectrow (row, true)
end if
prerow = row
Elseif KeyDown(KeyShift!) then // 按下“Shift”键时
SelectRow (0, false)
choose case true
case prerow < row
temprow = prerow
do while temprow <= row
selectrow (temprow, true)
temprow += 1
loop
case prerow > row
temprow = prerow
do while temprow >= row
selectrow (temprow, true)
temprow -= 1
loop
case prerow = row
selectrow (row, true)
end choose
else // 按下其它键或不按键时
SelectRow (0, false)
SelectRow (row, true)
prerow = row
end if
else // 没有点击行时,全部取消选择
SelectRow (0, false)
end if
/*===================================*
↑↑ 多选功能 ↑↑
*===================================*/
PB 数据窗口实现多选行
最新推荐文章于 2021-01-14 18:48:40 发布