MSHFlexGrid使用了flexMergeFree的功能后,要怎么才能高亮选中某一行呢,多谢大家了,急呀!!!!!!
Private Sub Form_Load()
Dim i As Integer, j As Integer
i = 10
j = 10
With MSHFlexGrid1
.Rows = 5
.Cols = 5
.MergeCells = flexMergeFree
.MergeRow(2) = True
For i = 1 To 5
For j = 1 To 5
.TextMatrix(i - 1, j - 1) = i
Next
Next
End With
End Sub
这里的意思是想怎么实现,用鼠标选择某一行后,进行高亮选中,多谢大家了!!!!!! --------------------编程问答-------------------- flexMergeFree了以后,无法高亮选中。
试试vsf。 --------------------编程问答--------------------
多谢你了,vsf要从哪里获得呢,多谢你了 --------------------编程问答-------------------- 问下king06
--------------------编程问答-------------------- http://hi.csdn.net/king06 --------------------编程问答-------------------- --------------------编程问答--------------------
用mshflexgrid还是可以实现的,多谢你了! --------------------编程问答--------------------
摇什么头?
上次自己送上门。
这次我给你做广告。 --------------------编程问答--------------------
Option Explicit--------------------编程问答--------------------
Dim CurrentRow As Integer, PreRow As Integer
Dim flag As Boolean
Private Sub Form_Load()
Dim i As Integer, j As Integer
i = 10
j = 10
With MSHFlexGrid1
.Rows = 5
.Cols = 6
.MergeCells = flexMergeFree
.MergeRow(2) = True
For i = 1 To 5
For j = 1 To 5
If j = 2 Then
.TextMatrix(i - 1, j - 1) = i
Else
.TextMatrix(i - 1, j - 1) = i + 10
End If
Next
Next
End With
PreRow = 1
flag = False
End Sub
Private Sub MSHFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim i As Integer
Command1.SetFocus
With MSHFlexGrid1
If .MouseRow = 0 Then Exit Sub
If PreRow = 1 And flag = False Then
.TextMatrix(1, 0) = "√" + .TextMatrix(1, 0)
flag = True
.Col = 0
.CellBackColor = vbDesktop
.CellForeColor = vbWhite
.CellFontBold = True
.CellFontSize = 12
For i = 1 To .Cols - 2
.Row = .MouseRow
.Col = i
.CellBackColor = vbDesktop
.CellForeColor = vbWhite
.CellFontBold = True
.CellFontSize = 12
Next
End If
CurrentRow = .MouseRow
If CurrentRow <> PreRow Then
.TextMatrix(PreRow, 0) = Mid(.TextMatrix(PreRow, 0), 2)
.Row = PreRow
.Col = 0
.CellBackColor = vbScrollBars
.CellForeColor = vbBlack
.CellFontBold = False
.CellFontSize = 9
For i = 1 To .Cols - 2
.Row = PreRow
.Col = i
.CellBackColor = vbWhite
.CellForeColor = vbBlack
.CellFontBold = False
.CellFontSize = 9
Next
.Row = CurrentRow
.Col = 0
.CellBackColor = vbDesktop
.CellForeColor = vbWhite
.TextMatrix(CurrentRow, 0) = "√" + .TextMatrix(CurrentRow, 0)
.CellFontBold = True
.CellFontSize = 12
PreRow = CurrentRow
For i = 1 To .Cols - 2
.Row = .MouseRow
.Col = i
.CellBackColor = vbDesktop
.CellForeColor = vbWhite
.CellFontBold = True
.CellFontSize = 12
Next
End If
End With
End Sub
我用过vsf后没玩过msf。你是怎么实现的? --------------------编程问答-------------------- 代码也许有些冗余,不过还是实现了,呵呵 --------------------编程问答-------------------- 呵呵,我当时找不到好的事件。
如有多行选中呢? --------------------编程问答--------------------
呵呵,多行没有试呢,不过感觉原理差不多吧,有空再试了:)
补充:VB , 基础类