Home > Software engineering >  MSHFlexGrid control consolidation cell, cell of the same content merging separately
MSHFlexGrid control consolidation cell, cell of the same content merging separately

Time:09-18

'the code below
Private Sub Form_Load ()
Dim I, j As Integer
MSHFlexGrid1. TextMatrix (2, 0)="A"
MSHFlexGrid1. TextMatrix (2, 1)="A"
MSHFlexGrid1. TextMatrix (2, 2)="A"
MSHFlexGrid1. TextMatrix (2, 3)="A"
'merger cell
MSHFlexGrid1. MergeRow (2)=True
MSHFlexGrid1. MergeCells=2
End Sub

After the operation effect is as follows:


I need to effect is as follows:


CodePudding user response:


This is the initial data, data, before merger control attribute set is 4 line, four columns

CodePudding user response:

Only to find a way to in the content, try this:
MSHFlexGrid1. TextMatrix (2, 0)="A"
MSHFlexGrid1. TextMatrix (2, 1)="A"
MSHFlexGrid1. TextMatrix (2, 2)="A"
MSHFlexGrid1. TextMatrix (2, 3)="A"

CodePudding user response:

Another way to hide a column:
 Private Sub Form_Load () 
MSHFlexGrid1. Rows=4
MSHFlexGrid1. Cols=5 'set 1 more column
MSHFlexGrid1. ColWidth (2)=0 'column 3 hidden
MSHFlexGrid1. TextMatrix (2, 0)="A"
MSHFlexGrid1. TextMatrix (2, 1)="A"
MSHFlexGrid1. TextMatrix (2, 3)="A"
MSHFlexGrid1. TextMatrix (2, 4)="A"
'merger cell
MSHFlexGrid1. MergeRow (2)=True
MSHFlexGrid1. MergeCells=2
End Sub
  • Related