Home › Forums › WinForms controls › Xceed Grid for WinForms › custom column manager row
-
AuthorPosts
-
#16493 |
Hi
My grid has two columns “Account Name ” and “Balance”
I have used following class to remove the borders on column manager row ( and display some effect to balance column).
Account column has empty title and balance column title is “Total” & vbcrlf & 25/09/2008 . Both columns are center align.
Columns are displays as bellow
____________________
Total
25/09/2008
_____________________
This works properly. But when the vertical scrolls bar is visible and , if I move vertical scroll bars to up and down, “Balance” column style is removed. (font —> to default font, and font bold —> to normal.)
Please help me to resolve this problem.
‘ Custom column manage class ——————————————
Imports System
Imports Xceed.Grid
Imports System.DrawingPublic Class CustomColumnManagerRow
Inherits Xceed.Grid.ColumnManagerRowProtected Sub New(ByVal template As CustomColumnManagerRow)
MyBase.New(template)
End SubPublic Sub New(ByVal selector As RowSelector)
MyBase.New(selector)
End SubPublic Sub New()
MyBase.New()
Me.AllowCellNavigation = False
Me.RowSelector.Visible = False
Me.AllowColumnReorder = False
Me.AllowDrop = False
Me.AllowSort = False
Me.HotTracking = False
Me.ShowTreeLine = False
Me.Height = DefaultHeight
Me.ShowFixedColumnSplitter = ShowFixedColumnSplitter.WhenFixedColumnsExist
End SubProtected Overrides Function CreateInstance() As Xceed.Grid.Row
Return New CustomColumnManagerRow(Me)
End FunctionProtected Overrides ReadOnly Property DefaultHeight() As Integer
Get
Return 32
End Get
End PropertyPublic Shadows Function GetFittedHeight(ByVal mode As AutoHeightMode) As Integer
Return 32
End FunctionProtected Overrides ReadOnly Property DefaultCanBeCurrent() As Boolean
Get
Return False
End Get
End PropertyPublic Overrides ReadOnly Property IsBackColorAmbient() As Boolean
Get
Return False
End Get
End PropertyProtected Overrides ReadOnly Property DefaultBackColor() As System.Drawing.Color
Get
Return Color.White
End Get
End PropertyProtected Overrides Function CreateCell(ByVal parentColumn As Column) As Cell
Dim c As Cell = New ColumnTitleCell(parentColumn)
c.HorizontalAlignment = Xceed.Grid.HorizontalAlignment.Center
Return c
End FunctionProtected Overrides Sub PaintBackground(ByVal e As GridPaintEventArgs)
End Sub
End ClassPublic Class ColumnTitleCell
Inherits ColumnManagerCell
Public Sub New(ByVal parentColumn As Column)
MyBase.New(parentColumn)
End SubPublic Sub New(ByVal template As ColumnTitleCell)
MyBase.New(template)
End SubProtected Overrides Function CreateInstance() As Cell
Dim c As Cell = New ColumnTitleCell(Me)
c.HorizontalAlignment = Xceed.Grid.HorizontalAlignment.Center
Return c
End FunctionProtected Overrides Sub PaintBackground(ByVal e As GridPaintEventArgs)
If Me.ParentColumn.FieldName = “Balance” Then
e.Graphics.DrawLine(Pens.Black, e.DisplayRectangle.X, 0, e.DisplayRectangle.X + e.BottomBorderWidth, 0)
e.Graphics.DrawLine(Pens.Blue, e.DisplayRectangle.X + 2, 15, e.DisplayRectangle.X + 2, 20)
e.Graphics.DrawLine(Pens.Blue, e.DisplayRectangle.X + e.BottomBorderWidth – 1, 15, e.DisplayRectangle.X + e.BottomBorderWidth – 1, 20)
e.Graphics.DrawLine(Pens.Black, e.DisplayRectangle.X, Me.ParentRow.Height – 1, e.DisplayRectangle.X + e.BottomBorderWidth, Me.ParentRow.Height – 1)
End If
End Sub
End Class
Imported from legacy forums. Posted by Tharaka (had 1592 views)
Can anyone help me to resolve above problem?
Imported from legacy forums. Posted by Tharaka (had 404 views)
-
AuthorPosts
- You must be logged in to reply to this topic.