PB程式:
我有一張表,單擊滑鼠選擇一行,如果按下CTRL鍵后點擊則選擇多行,如何撰寫程式?
uj5u.com熱心網友回復:
If KeyDown ( keycontrol! ) ThenIf This.IsSelected(row) Then
This.SelectRow(row,False)
Else
This.SelectRow(row,True)
End If
Else
This.SelectRow(0,False)
This.SelectRow(row,True)
This.SetRow(row)
End If
一個問題開倆帖子。你分很多啊。而且這段代碼網上很容易搜出來!呵呵
uj5u.com熱心網友回復:
google 上 baiduuj5u.com熱心網友回復:
如果不用按CTRL鍵也可以實作的,反而更省代碼://clicked事件
if isselected(il_row) then
this.selectrow(il_row,false)
else
this.selectrow(il_row,true)
end if
uj5u.com熱心網友回復:
給你一段多行選擇的代碼,支持SHIFT 連選 CTRL 指定選擇string ls_KeyDownType
If rrow <= 0 then Return 0
If Keydown(KeyShift!) then
integer li_Idx
al_aclickedrow=rrow
this.setredraw(false)
this.selectrow(0,false)
If il_lastclickedrow = 0 then
this.setredraw(true)
Return 1
end if
if il_lastclickedrow > al_aclickedrow then
For li_Idx = il_lastclickedrow to al_aclickedrow STEP -1
this.selectrow(li_Idx,TRUE)
end for
else
For li_Idx = il_lastclickedrow to al_aclickedrow
this.selectrow(li_Idx,TRUE)
next
end if
this.setredraw(true)
Return 1
////////////////
ElseIf this.IsSelected(rrow) Then
il_LastClickedRow = rrow
ib_action_on_buttonup = true
ElseIf Keydown(KeyControl!) then
il_LastClickedRow = rrow
this.SelectRow(rrow,TRUE)
Else
il_LastClickedRow = rrow
this.SelectRow(0,FALSE)
this.SelectRow(rrow,TRUE)
End If
///////////////////
If ib_action_on_buttonup Then
ib_action_on_buttonup = false
If Keydown(KeyControl!) then
this.selectrow(il_lastclickedrow,FALSE)
Else
this.SelectRow(0,FALSE)
this.SelectRow(il_lastclickedrow,TRUE)
End If
il_lastclickedrow = 0
End If
uj5u.com熱心網友回復:
思路就是 key 判斷按下的是什么鍵 ,然后使用 selectrow()uj5u.com熱心網友回復:
參考pb8.0的pfc轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/97942.html
標籤:腳本語言
上一篇:本機裝的激光列印機,有個針式的網路列印機,程式要列印連續紙,如何設定網路列印機的自定義紙張。
下一篇:急求幫助,有分相送!
