Home › Forums › WinForms controls › Xceed Grid for WinForms › Multiple columns
-
AuthorPosts
-
#13502 |
In VB code there is sintax error:
e.Graphics.DrawLine(Me.ParentGrid.ParentGrid.GRIDLINEPEN, e.DisplayRectangle.X + width – 1, 0, e.DisplayRectangle.X + width – 1, Me.Height)
>>>>> “GRIDLINEPEN isn’t a member of Xceed.Grid.DetailGrid”
(http://doc.xceedsoft.com/products/gridNET/doc/sources/how_to_create_multiple_column_headers.htm)
Can you help me?
Thanks.Imported from legacy forums. Posted by AndreaZ (had 927 views)
Replace <b>Me.ParentGrid.GridLinePen</b> with <b>Me.GridControl.GridLinePen</b>.
Imported from legacy forums. Posted by Tommy (had 131 views)
Hi,
the sintax is correct but the class doesn’t work (no exceptions).
There are another simples project about the Multiple columns? (in VB code)
(‘http://doc.xceedsoft.com/products/gridNET/doc/sources/how_to_create_multiple_column_headers.htm)The Multiple columns work also with the data bound column? (because the ColumnManagerRow is automatically crated)
Thanks.
Imported from legacy forums. Posted by AndreaZ (had 471 views)
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)
I’ve played a bit with the project you sent me, and I’ve found a way to make it work. Replace this piece of code:<code>Protected Overrides ReadOnly Property DefaultHeight() As Integer
Get
Return 16
End Get
End Property</code>with this piece of code:<code>Public Overrides Function GetFittedHeight(ByVal mode As AutoHeightMode) As Integer
Return 16
End Function</code>Imported from legacy forums. Posted by Tommy (had 152 views)
<b>Big man!!!</b> (…like Clarence Clemons ;-))
Imported from legacy forums. Posted by AndreaZ (had 311 views)
Excuse me,
how I can insert a different text for each headers?
thank you.
Imported from legacy forums. Posted by AndreaZ (had 450 views)
For each ‘Cell’ in your row, calculate the rectangle (x, y, width, height), and use DrawString. If you want to center the text, change the StringFormat argument.<code>Dim myText As String = … ‘ fill in correct text
Dim myRectangle As Rectangle = new Rectangle(x + 1, y + 1, width – 2, height – 2)
Dim textColor As Color = Me.GetForeColorToPaint
Using textBrush As SolidBrush = New SolidBrush(textColor)
Using textFormat As StringFormat = New StringFormat
textFormat.Alignment = StringAlignment.Center
textFormat.LineAlignment = StringAlignment.Center
e.Graphics.DrawString(myText, Me.Font, textBrush, CType(myRectangle, RectangleF), textFormat)
End Using
End Using</code>Imported from legacy forums. Posted by Tommy (had 5784 views)
-
AuthorPosts
- You must be logged in to reply to this topic.