Home Forums WinForms controls Xceed Grid for WinForms custom column manager row

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #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.Drawing

    Public Class CustomColumnManagerRow
        Inherits Xceed.Grid.ColumnManagerRow

        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()
            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 Sub

        Protected Overrides Function CreateInstance() As Xceed.Grid.Row
            Return New CustomColumnManagerRow(Me)
        End Function

        Protected Overrides ReadOnly Property DefaultHeight() As Integer
            Get
                Return 32
            End Get
        End Property

        Public Shadows Function GetFittedHeight(ByVal mode As AutoHeightMode) As Integer
            Return 32
        End Function

        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 Color.White
            End Get
        End Property

        Protected 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 Function

        Protected Overrides Sub PaintBackground(ByVal e As GridPaintEventArgs)

        End Sub
    End Class

    Public Class ColumnTitleCell
        Inherits ColumnManagerCell
        Public Sub New(ByVal parentColumn As Column)
            MyBase.New(parentColumn)
        End Sub

        Public Sub New(ByVal template As ColumnTitleCell)
            MyBase.New(template)
        End Sub

        Protected Overrides Function CreateInstance() As Cell
            Dim c As Cell = New ColumnTitleCell(Me)
            c.HorizontalAlignment = Xceed.Grid.HorizontalAlignment.Center
            Return c
        End Function

        Protected 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)

    User (Old forums)
    Member
    Post count: 23064

    Can anyone help me to resolve above problem?

    Imported from legacy forums. Posted by Tharaka (had 404 views)

    User (Old forums)
    Member
    Post count: 23064

    Send a sample application reproducing the issue to support, so we can try to identify the problem.

    Imported from legacy forums. Posted by André (had 1332 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.