Home > Software engineering >  Mshflexgrid control, as shown in figure header to merge, cell don't merge
Mshflexgrid control, as shown in figure header to merge, cell don't merge

Time:10-23

Mshflexgrid control, how to implement the header columns, and cells do not merge,
Such as:
Header: on August 15, owe Hugh number
Monday to owe Hugh number
Form: zhang 3
Li si 3

Request header owe Hugh number of merger, but not merge table 3

CodePudding user response:

Data even in data string before and after each plus a CRH (255) not visible characters (for center alignment) :
 Private Sub Form_Load () 
With MSFlexGrid1
Cols=2
. The Rows=0
The AddItem "August 15" & amp; VbTab & amp; "Owe Hugh number", 0
The AddItem "Monday" & amp; VbTab & amp; "Owe Hugh number," 1
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; CRH (255) & amp; "3" & amp; CRH (255)

. FixedCols=0
FixedRows=2
ColAlignment (0)=4
ColAlignment (1)=4
. MergeCells=flexMergeRestrictColumns
MergeCol (1)=True
End With
End Sub

CodePudding user response:

You this solution is only suitable for line number is less, I call data from the database, all line number is more, can't a a plus, strives for the solution, thank god!!!!!!

CodePudding user response:

Great god not reply, your help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CodePudding user response:

You can only handle displayed a try, like this:
 Private Sub Form_Load () 
With MSHFlexGrid1
Cols=2
. The Rows=0
The AddItem "August 15" & amp; VbTab & amp; "Owe Hugh number", 0
The AddItem "Monday" & amp; VbTab & amp; "Owe Hugh number," 1
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
The AddItem "zhang SAN" & amp; VbTab & amp; "3"
The AddItem "bill" & amp; VbTab & amp; "3"
. FixedCols=0
FixedRows=2
ColAlignment (0)=4
ColAlignment (1)=4
. MergeCells=flexMergeRestrictColumns
MergeCol (1)=True
End With
Call MSHFlexGrid1_Scroll
End Sub

Private Sub MSHFlexGrid1_Scroll ()
Dim As Long I
With MSHFlexGrid1
For I=. TopRow To.. Rows 1
If the RowData (I) & lt;> 1 Then
If I Mod 2=0 Then
TextMatrix (I, 1)="" & amp; TextMatrix (I, 1) & amp; "
"End the If
RowData (I)=1 'tag, this line has been processed, the next time shows that this line is don't add space
End the If
Next
End With
End Sub

CodePudding user response:

In the event of an insensitive to write code fill the two sides of the special characters,
The above write wrong, missed a condition
 Private Sub MSHFlexGrid1_Scroll () 
Dim As Long I
With MSHFlexGrid1
For I=. TopRow To.. Rows 1
If the RowIsVisible (I) And RowData (I) & lt;> 1 Then
If I Mod 2=0 Then
TextMatrix (I, 1)="" & amp; TextMatrix (I, 1) & amp; "
"End the If
RowData (I)=1 'tag, this line has been processed, the next time shows that this line is don't add space
End the If
Next
End With
End Sub
  • Related