如何设置MSFlexGrid控件的单元格颜色

netfor2000 2003-01-19 04:11:47
用下法,MSFlexGrid的闪动太大,有别的方法吗?使得显示很快速而平滑

MSFlexGrid1.row=i
MSFlexGrid1.col=0
MSFlexGrid1.CellBackColor = &HC0FFFF
MSFlexGrid1.col=1
MSFlexGrid1.CellBackColor = &HC0FFFF
MSFlexGrid1.col=3
MSFlexGrid1.CellBackColor = &HC0FFFF
MSFlexGrid1.col=5
MSFlexGrid1.CellBackColor = &HC0FFFF
MSFlexGrid1.col=7
MSFlexGrid1.CellBackColor = &HC0FFFF
MSFlexGrid1.col=9
MSFlexGrid1.CellBackColor = &HC0FFFF

....
...全文
102 点赞 收藏 1
写回复
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
programart_life 2003-01-19

用LockWindowUpdate函数来锁定窗口,然后进行更新,然后再解锁

源代码如下,我手写的,不知道有没有错
'//API函数原形我忘记了,你查查手册
private declare function lockWindowUpdate (byval hwnd as Long) as long

private sub command1_click()
dim x as long, y as long

mshflexgrid1.rows = 100
mshflexgrid1.cols = 100
lockwindowupdate mshflexgrid1.hwnd
for x = 1 to 100 - 1
for y = 1 to 100 - 1
mshflexgrid1.col = x
mshflexgrid1.row = y
mshflexgrid1.cellbackcolor = vbgreen
next
next
lockwindowupdate false
end sub
回复
发动态
发帖子
VB基础类
创建于2007-09-28

7451

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告