关于MSFlexGrid

hnzsy 2002-09-11 03:40:27
请问如何改变MSFlexGrid的列标题
...全文
73 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
szgw 2002-09-12
MSHFlexGrid1.Clear
MSHFlexGrid1.Rows = re10.RecordCount + 1
MSHFlexGrid1.Cols = re10.Fields.Count + 1
MSHFlexGrid1.FixedRows = 0
MSHFlexGrid1.Row = 0
MSHFlexGrid1.Col = 0
MSHFlexGrid1.Text = ""
MSHFlexGrid1.Col = 1
MSHFlexGrid1.Text = "SDFSD"
MSHFlexGrid1.Col = 2
MSHFlexGrid1.Text = " FFFF"
MSHFlexGrid1.Col = 3
MSHFlexGrid1.Text = " DDD"
MSHFlexGrid1.Col = 4
MSHFlexGrid1.Text = " DDDF"
MSHFlexGrid1.Col = 5
MSHFlexGrid1.Text = " GSSA"
MSHFlexGrid1.Col = 6
MSHFlexGrid1.Text = "GGHHH"
MSHFlexGrid1.Col = 7
MSHFlexGrid1.Text = " HDFGDFG"
MSHFlexGrid1.Col = 8
MSHFlexGrid1.Text = " FDGDF"
MSHFlexGrid1.Col = 9
MSHFlexGrid1.Text = " GHJG"
MSHFlexGrid1.Col = 10
MSHFlexGrid1.Text = " AAAAA"
MSHFlexGrid1.ColWidth(0) = 200
MSHFlexGrid1.ColWidth(1) = 1200
MSHFlexGrid1.ColWidth(2) = 420
MSHFlexGrid1.ColWidth(3) = 420
MSHFlexGrid1.ColWidth(4) = 1000
MSHFlexGrid1.ColWidth(5) = 1000
MSHFlexGrid1.ColWidth(6) = 1200
MSHFlexGrid1.ColWidth(7) = 800
MSHFlexGrid1.ColWidth(8) = 1800
MSHFlexGrid1.ColWidth(9) = 600
re10.MoveFirst
m = 0
j = 0
For m = 1 To re10.RecordCount
mymark = re10.bookmark
MSHFlexGrid1.Row = m
For j = 0 To re10.Fields.Count - 1
MSHFlexGrid1.Col = j + 1
MSHFlexGrid1.Text = re10.Fields(j).Value & ""
MSHFlexGrid1.CellAlignment = flexAlignLeftCenter
Next j
MSHFlexGrid1.Refresh
j = j + 1

StatusBar1.SimpleText = "¸÷ºÏͬ¿Í»§Àۼƹ²ÓÐ:" & mymark & "ÌõÏû·ÑÏîÄ¿"
re10.MoveNext
Next m
With MSHFlexGrid1
If .Rows > 1 Then
.FillStyle = flexFillRepeat
For i = .FixedRows + 1 To .Rows - 1 Step 2
.Row = i
.Col = .FixedCols
.ColSel = .Cols() - .FixedCols
.CellBackColor = &H8000000F 'vbInfoBackground ' light grey
Next i
.FillStyle = flexFillSingle
'.Sort = flexSortGenericAscending
'.MergeCells = flexMergeRestrictColumns
End If
End With
回复
pufeng_999 2002-09-12
同意liucai(流才)的方法
就是用MSFlexGrid1的TextMatrix方法
回复
hnzsy 2002-09-12
我试了一下好像不行,是不是还要改哪些设置?
回复
free7090 2002-09-12
你可以通过查询来显示你说要的标题呀
例如select id as 编号,name as 姓名 from table
然后再通过数据绑定就可以了
回复
wxqjl007 2002-09-11
同上!!

TextMatrix 属性


返回或设置一个任意单元的文本内容。

语法

object.TextMatrix(rowindex, colindex) [=string]

TextMatrix 属性的语法包含如下部分:

部分 描述
object 一个对象表达式,其值为“应用于”列表中的一个对象。
rowindex, colindex 整数。一个数值表达式,指定要读或写哪一个单元。
String 一个字符串表达式,包含一个任意的单元的内容。


说明

这一属性允许不更改 Row 和 Col 属性来设置或获取一个单元的内容。


回复
liucai 2002-09-11
MSFlexGrid1.TextMatrix(0, 0) = "adfasdf"

TextMatrix(row,col)属性
row:行
col:列

第0行即为标题
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7490

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2002-09-11 03:40
社区公告
暂无公告