>>怎样来实现MSFlexGrid控件单数行背景为白色,双数的行背景为蓝色?
Dim i As Integer
With MSFlexGrid1
.AllowBigSelection = True ’ 设置网格样式
.FillStyle = flexFillRepeat
For i = 0 To .Rows - 1
.Row = i: .Col = .FixedCols
.ColSel = .Cols() - .FixedCols - 1
If i Mod 2 = 0 Then
.CellBackColor = &HC0C0C0 ’ 浅灰
Else
.CellBackColor = vbBlue ’ 兰色
End If
Next i
End With
==================
很想弄清楚
.Row = i: .Col = .FixedCols
.ColSel = .Cols() - .FixedCols - 1
这二行代码的具体含义,尤其是那个
i: .col
是什么意思???谢谢大家!!!
Dim i As Integer
With MSFlexGrid1
.AllowBigSelection = True ’ 设置网格样式
.FillStyle = flexFillRepeat
For i = 0 To .Rows - 1
.Row = i: .Col = .FixedCols
.ColSel = .Cols() - .FixedCols - 1
If i Mod 2 = 0 Then
.CellBackColor = &HC0C0C0 ’ 浅灰
Else
.CellBackColor = vbBlue ’ 兰色
End If
Next i
End With
==================
很想弄清楚
.Row = i: .Col = .FixedCols
.ColSel = .Cols() - .FixedCols - 1
这二行代码的具体含义,尤其是那个
i: .col
是什么意思???谢谢大家!!!
比如: dim a as long
a=10
可以写成: dim a as long : a=10 跟上面2行是等价的。
=================================================== .Row = i: .Col = .FixedCols 的含义是:MSFlexGrid1.row=i : MSFlexGrid1.col=MSFlexGrid1.FixedCols =====================================================VB中可以用With定义一个块:比如: picture1.height=1000
picture1.width=999可以写成:with picture1
.height=1000
.width=999
end with
.Row =i是获得行号的意思
用冒号可以多行的代码写在一行.Row = i: .Col = .FixedCols
既是
.Row = i
.Col = .FixedCols
'2. 一些变量宣告的简写Dim i%,j%,k%
等于
Dim i as Integer
Dim j as Integer
Dim k as IntegerDim i%
With MSFlexGrid1
.AllowBigSelection = True ’ 设置网格样式
.FillStyle = flexFillRepeat
For i = 0 To .Rows - 1
.Row = i: .Col = .FixedCols
.ColSel = .Cols() - .FixedCols - 1
.CellBackColor =Iif(i Mod 2 = 0,&HC0C0C0,vbBlue)
Next i
End With
.ColSel = .Cols() - .FixedCols - 1
是什么意思呢??而且我发现在程序中执行完这段代码之后,msflexgrid中的数据的最后一行是被选定的状态的。
我想在运行完这段代码之后,不让选定任意一行或列或单元格。而且msflexgrid在行选或列选时,往往第一个单元格都不能被选中。请问有什么方法能实现选一行时就连第一个单元格也选中列选时同理!!
如果你想完成这个功能,需要在设置上调调,比如当选中时高亮,或者永远不高亮
第一个单元格问题也是在设置上调的。多弄点设置组合
'-----------------------
欢迎来我的小店坐坐:程序员雅琪的小店
.ColSel = .Cols() - .FixedCols - 1
这二行代码的具体含义,尤其是那个
i: .col
是什么意思??? ":"在VB中可以将多句执行语句写在一行上,建议不要这样写,特别对于复杂的程序,在理解上有点困难,不易维护.
".Col" 在VB中经常引用某一对象时,可以使用WITH ....END WITH,这样在WITH....END WITH 块中只写一个"."就可以对当前对象加以引用了,