Home Forums WinForms controls Xceed Grid for WinForms Multiple columns Reply To: Multiple columns

User (Old forums)
Member
Post count: 23064

Excuse me,

In a DataBound grid I have this columns – create automatically with: Grid1.SetDataBinding(myDS, myDtRegistrazioni.ToString):
______________________
|_A_|_B_|_C_|_D_|_E_|_F_|

I need:
______________________
|___________A__________|
|_____A1____|____A2____|
|_A_|_B_|_C_|_D_|_E_|_F_|

I wrote:

Grid1.FixedHeaderRows.Insert(0, New CustomColumnManagerRow(1))
Grid1.FixedHeaderRows.Insert(1, New CustomColumnManagerRow(Grid1.Columns.Count / 2))
ColumnManagerRow1.AllowColumnReorder = False
ColumnManagerRow2.AllowColumnReorder = False

****************

Public Class CustomColumnManagerRow
Inherits Row
Private m_columns As Integer = 0
Protected Sub New(ByVal template As CustomColumnManagerRow)
MyBase.New(template)
End Sub
Public Sub New(ByVal selector As RowSelector)
MyBase.New(selector)
End Sub
Public Sub New(ByVal columns As Integer)
MyBase.New()
m_columns = columns
End Sub
Protected Overrides Function CreateInstance() As Xceed.Grid.Row
Return New CustomColumnManagerRow(Me)
End Function
Protected Overrides Sub PaintForeground(ByVal e As GridPaintEventArgs)
Dim width As Integer = 0
Dim lastColumn As Integer = 0
For j As Integer = 0 To Me.ParentGrid.Columns.Count \ m_columns – 1
For i As Integer = 0 To m_columns – 1
width += Me.ParentGrid.Columns(lastColumn).Width
lastColumn = lastColumn + 1
Next i
e.Graphics.DrawLine(Me.GridControl.GridLinePen, e.DisplayRectangle.X + width – 1, 0, e.DisplayRectangle.X + width – 1, Me.Height)
Next j
End Sub
Protected Overrides ReadOnly Property DefaultHeight() As Integer
Get
Return 16
End Get
End Property
Protected Overrides ReadOnly Property DefaultCanBeCurrent() As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property IsBackColorAmbient() As Boolean
Get
Return False
End Get
End Property
Protected Overrides ReadOnly Property DefaultBackColor() As System.Drawing.Color
Get
Return SystemColors.Control
End Get
End Property
End Class

****************

It’s correct?? Don’t work!
I don’t see the new CustomColumnManagerRows!

Thanks.

Imported from legacy forums. Posted by AndreaZ (had 446 views)