MSHFlexGrid1使用技巧(一)[如何让MSHFlexGrid只能被选中一行]

作者:网络 来源:佚名 更新时间:2008-02-06 02:24:51 点击:
mshflexgrid控件点击时可以选中多行,但有时我们需要仅仅选中一行,有一个小技巧:



option explicit
dim currentrow as integer
private sub form_load()
dim i as integer, j as integer
with mshflexgrid1
.rows = 10
.cols = 4
for i = 1 to 9
.textmatrix(i, 0) = "第 " & i & " 行"
for j = 1 to 3
.textmatrix(0, j) = "第 " & j & " 列"
.textmatrix(i, j) = i & "," & j
next
next
end with
end sub
private sub mshflexgrid1_mousedown(button as integer, shift as integer, x as single, y as single)
with mshflexgrid1
.row = .mouserow
currentrow = .row
.col = 0
.colsel = .cols - 1
end with
end sub
private sub mshflexgrid1_mouseup(button as integer, shift as integer, x as single, y as single)
with mshflexgrid1
.rowsel = currentrow
.colsel = .cols - 1
end with
end sub