DataGrid Col Header Alignment

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Doug Bell

    #1

    DataGrid Col Header Alignment

    Hi
    Does anyone know (or point me where I can find) how to set the alignment of
    a DataGrid Column Header different to the alignment of the column.

    I am trying to show some Right aligned columns and the header looks wrong
    squashed to the right. If I could even add a trailing space but it trims any
    trailing spaces off.

    Thanks

    Doug


  • Ken Tucker [MVP]

    #2
    Re: DataGrid Col Header Alignment

    Hi,



    Ken
    ---------------
    "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
    news:%23BXV9k6o FHA.764@TK2MSFT NGP14.phx.gbl.. .[color=blue]
    > Hi
    > Does anyone know (or point me where I can find) how to set the alignment
    > of
    > a DataGrid Column Header different to the alignment of the column.
    >
    > I am trying to show some Right aligned columns and the header looks wrong
    > squashed to the right. If I could even add a trailing space but it trims
    > any
    > trailing spaces off.
    >
    > Thanks
    >
    > Doug
    >
    >[/color]


    Comment

    • Doug Bell

      #3
      Re: DataGrid Col Header Alignment

      Thanks Ken

      "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
      news:%23OMRwO7o FHA.2472@tk2msf tngp13.phx.gbl. ..[color=blue]
      > Hi,
      >
      >[/color]
      http://www.windowsformsdatagridhelp....5-49bb9074a8bc[color=blue]
      >
      > Ken
      > ---------------
      > "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
      > news:%23BXV9k6o FHA.764@TK2MSFT NGP14.phx.gbl.. .[color=green]
      > > Hi
      > > Does anyone know (or point me where I can find) how to set the alignment
      > > of
      > > a DataGrid Column Header different to the alignment of the column.
      > >
      > > I am trying to show some Right aligned columns and the header looks[/color][/color]
      wrong[color=blue][color=green]
      > > squashed to the right. If I could even add a trailing space but it trims
      > > any
      > > trailing spaces off.
      > >
      > > Thanks
      > >
      > > Doug
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Doug Bell

        #4
        Re: DataGrid Col Header Alignment

        Ken,
        That works very well, leaving the header Left Aligned while setting the Data
        to Right Aligned.

        I merged it in with my Paint and Edit Overrides.

        It does however ignore the number formatting now.
        I had the Format property set to :
        ..Format = ("#,##0.000 ;(#,##0.000) ;0.000 ")



        "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
        news:%23OMRwO7o FHA.2472@tk2msf tngp13.phx.gbl. ..[color=blue]
        > Hi,
        >
        >[/color]
        http://www.windowsformsdatagridhelp....5-49bb9074a8bc[color=blue]
        >
        > Ken
        > ---------------
        > "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
        > news:%23BXV9k6o FHA.764@TK2MSFT NGP14.phx.gbl.. .[color=green]
        > > Hi
        > > Does anyone know (or point me where I can find) how to set the alignment
        > > of
        > > a DataGrid Column Header different to the alignment of the column.
        > >
        > > I am trying to show some Right aligned columns and the header looks[/color][/color]
        wrong[color=blue][color=green]
        > > squashed to the right. If I could even add a trailing space but it trims
        > > any
        > > trailing spaces off.
        > >
        > > Thanks
        > >
        > > Doug
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Ken Tucker [MVP]

          #5
          Re: DataGrid Col Header Alignment

          Hi,

          Here is an updated version

          Public Class HeaderAndDataAl ignColumn
          Inherits DataGridTextBox Column

          Private mTxtAlign As HorizontalAlign ment = HorizontalAlign ment.Left
          Private mDrawTxt As New StringFormat

          Protected Overloads Overrides Sub Edit(ByVal source As
          System.Windows. Forms.CurrencyM anager, ByVal rowNum As Integer, ByVal bounds
          As System.Drawing. Rectangle, ByVal [readOnly] As Boolean, ByVal instantText
          As String, ByVal cellIsVisible As Boolean)
          MyBase.Edit(sou rce, rowNum, bounds, [readOnly], instantText,
          cellIsVisible)
          MyBase.TextBox. TextAlign = mTxtAlign
          MyBase.TextBox. CharacterCasing = CharacterCasing .Upper
          End Sub

          Protected Overloads Overrides Sub Paint(ByVal g As
          System.Drawing. Graphics, ByVal bounds As System.Drawing. Rectangle, ByVal
          source As System.Windows. Forms.CurrencyM anager, ByVal rowNum As Integer,
          ByVal backBrush As System.Drawing. Brush, ByVal foreBrush As
          System.Drawing. Brush, ByVal alignToRight As Boolean)
          'clear the cell
          g.FillRectangle (backBrush, bounds)

          'draw the value
          Dim s As String
          If TypeOf Me.GetColumnVal ueAtRow([source], rowNum) Is Decimal Then
          s = CDec(Me.GetColu mnValueAtRow([source],
          rowNum)).ToStri ng(Me.Format)
          Else
          s = Me.GetColumnVal ueAtRow([source], rowNum).ToStrin g
          End If
          Dim r As Rectangle = bounds
          r.Inflate(0, -1)
          g.DrawString(s, MyBase.TextBox. Font, foreBrush,
          RectangleF.op_I mplicit(r), _
          mDrawTxt)
          End Sub

          Public Property DataAlignment() As HorizontalAlign ment
          Get
          Return mTxtAlign
          End Get
          Set(ByVal Value As HorizontalAlign ment)
          mTxtAlign = Value
          If mTxtAlign = HorizontalAlign ment.Center Then
          mDrawTxt.Alignm ent = StringAlignment .Center
          ElseIf mTxtAlign = HorizontalAlign ment.Right Then
          mDrawTxt.Alignm ent = StringAlignment .Far
          Else
          mDrawTxt.Alignm ent = StringAlignment .Near
          End If
          End Set
          End Property

          End Class

          Ken
          ---------------------
          "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
          news:OAEtgy9oFH A.3828@TK2MSFTN GP12.phx.gbl...[color=blue]
          > Ken,
          > That works very well, leaving the header Left Aligned while setting the
          > Data
          > to Right Aligned.
          >
          > I merged it in with my Paint and Edit Overrides.
          >
          > It does however ignore the number formatting now.
          > I had the Format property set to :
          > .Format = ("#,##0.000 ;(#,##0.000) ;0.000 ")
          >
          >
          >
          > "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
          > news:%23OMRwO7o FHA.2472@tk2msf tngp13.phx.gbl. ..[color=green]
          >> Hi,
          >>
          >>[/color]
          > http://www.windowsformsdatagridhelp....5-49bb9074a8bc[color=green]
          >>
          >> Ken
          >> ---------------
          >> "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
          >> news:%23BXV9k6o FHA.764@TK2MSFT NGP14.phx.gbl.. .[color=darkred]
          >> > Hi
          >> > Does anyone know (or point me where I can find) how to set the
          >> > alignment
          >> > of
          >> > a DataGrid Column Header different to the alignment of the column.
          >> >
          >> > I am trying to show some Right aligned columns and the header looks[/color][/color]
          > wrong[color=green][color=darkred]
          >> > squashed to the right. If I could even add a trailing space but it
          >> > trims
          >> > any
          >> > trailing spaces off.
          >> >
          >> > Thanks
          >> >
          >> > Doug
          >> >
          >> >[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • Doug Bell

            #6
            Re: DataGrid Col Header Alignment

            Ken,
            That still does not format the field.
            In that particular case, the Data Type is a Double and your code tests for
            Decimal.

            So changing the code to:
            If TypeOf Me.GetColumnVal ueAtRow([source], rowNum) Is Double Then


            Works but If I wanted to make the code generic for all data types would I
            have to use a Select and then format for each different type or is there a
            more elegant way to make it generic?

            eg
            Select Case TypeOf Me.GetColumnVal ueAtRow([source], rowNum)

            Case Is Integer

            Case Is Double

            Case Is String


            "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
            news:%23wgw8$9o FHA.2156@TK2MSF TNGP14.phx.gbl. ..[color=blue]
            > Hi,
            >
            > Here is an updated version
            >
            > Public Class HeaderAndDataAl ignColumn
            > Inherits DataGridTextBox Column
            >
            > Private mTxtAlign As HorizontalAlign ment = HorizontalAlign ment.Left
            > Private mDrawTxt As New StringFormat
            >
            > Protected Overloads Overrides Sub Edit(ByVal source As
            > System.Windows. Forms.CurrencyM anager, ByVal rowNum As Integer, ByVal[/color]
            bounds[color=blue]
            > As System.Drawing. Rectangle, ByVal [readOnly] As Boolean, ByVal[/color]
            instantText[color=blue]
            > As String, ByVal cellIsVisible As Boolean)
            > MyBase.Edit(sou rce, rowNum, bounds, [readOnly], instantText,
            > cellIsVisible)
            > MyBase.TextBox. TextAlign = mTxtAlign
            > MyBase.TextBox. CharacterCasing = CharacterCasing .Upper
            > End Sub
            >
            > Protected Overloads Overrides Sub Paint(ByVal g As
            > System.Drawing. Graphics, ByVal bounds As System.Drawing. Rectangle, ByVal
            > source As System.Windows. Forms.CurrencyM anager, ByVal rowNum As Integer,
            > ByVal backBrush As System.Drawing. Brush, ByVal foreBrush As
            > System.Drawing. Brush, ByVal alignToRight As Boolean)
            > 'clear the cell
            > g.FillRectangle (backBrush, bounds)
            >
            > 'draw the value
            > Dim s As String
            > If TypeOf Me.GetColumnVal ueAtRow([source], rowNum) Is Decimal Then
            > s = CDec(Me.GetColu mnValueAtRow([source],
            > rowNum)).ToStri ng(Me.Format)
            > Else
            > s = Me.GetColumnVal ueAtRow([source], rowNum).ToStrin g
            > End If
            > Dim r As Rectangle = bounds
            > r.Inflate(0, -1)
            > g.DrawString(s, MyBase.TextBox. Font, foreBrush,
            > RectangleF.op_I mplicit(r), _
            > mDrawTxt)
            > End Sub
            >
            > Public Property DataAlignment() As HorizontalAlign ment
            > Get
            > Return mTxtAlign
            > End Get
            > Set(ByVal Value As HorizontalAlign ment)
            > mTxtAlign = Value
            > If mTxtAlign = HorizontalAlign ment.Center Then
            > mDrawTxt.Alignm ent = StringAlignment .Center
            > ElseIf mTxtAlign = HorizontalAlign ment.Right Then
            > mDrawTxt.Alignm ent = StringAlignment .Far
            > Else
            > mDrawTxt.Alignm ent = StringAlignment .Near
            > End If
            > End Set
            > End Property
            >
            > End Class
            >
            > Ken
            > ---------------------
            > "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
            > news:OAEtgy9oFH A.3828@TK2MSFTN GP12.phx.gbl...[color=green]
            > > Ken,
            > > That works very well, leaving the header Left Aligned while setting the
            > > Data
            > > to Right Aligned.
            > >
            > > I merged it in with my Paint and Edit Overrides.
            > >
            > > It does however ignore the number formatting now.
            > > I had the Format property set to :
            > > .Format = ("#,##0.000 ;(#,##0.000) ;0.000 ")
            > >
            > >
            > >
            > > "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
            > > news:%23OMRwO7o FHA.2472@tk2msf tngp13.phx.gbl. ..[color=darkred]
            > >> Hi,
            > >>
            > >>[/color]
            > >[/color][/color]
            http://www.windowsformsdatagridhelp....5-49bb9074a8bc[color=blue][color=green][color=darkred]
            > >>
            > >> Ken
            > >> ---------------
            > >> "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
            > >> news:%23BXV9k6o FHA.764@TK2MSFT NGP14.phx.gbl.. .
            > >> > Hi
            > >> > Does anyone know (or point me where I can find) how to set the
            > >> > alignment
            > >> > of
            > >> > a DataGrid Column Header different to the alignment of the column.
            > >> >
            > >> > I am trying to show some Right aligned columns and the header looks[/color]
            > > wrong[color=darkred]
            > >> > squashed to the right. If I could even add a trailing space but it
            > >> > trims
            > >> > any
            > >> > trailing spaces off.
            > >> >
            > >> > Thanks
            > >> >
            > >> > Doug
            > >> >
            > >> >
            > >>
            > >>[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Ken Tucker [MVP]

              #7
              Re: DataGrid Col Header Alignment

              Hi,

              I need to add that functionality to the class. I havent come up
              with the best method and will post an update when I do.

              Ken
              -----------------
              "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
              news:%23Fi31K%2 3oFHA.3916@TK2M SFTNGP12.phx.gb l...[color=blue]
              > Ken,
              > That still does not format the field.
              > In that particular case, the Data Type is a Double and your code tests for
              > Decimal.
              >
              > So changing the code to:
              > If TypeOf Me.GetColumnVal ueAtRow([source], rowNum) Is Double Then
              >
              >
              > Works but If I wanted to make the code generic for all data types would I
              > have to use a Select and then format for each different type or is there a
              > more elegant way to make it generic?
              >
              > eg
              > Select Case TypeOf Me.GetColumnVal ueAtRow([source], rowNum)
              >
              > Case Is Integer
              >
              > Case Is Double
              >
              > Case Is String
              >
              >
              > "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
              > news:%23wgw8$9o FHA.2156@TK2MSF TNGP14.phx.gbl. ..[color=green]
              >> Hi,
              >>
              >> Here is an updated version
              >>
              >> Public Class HeaderAndDataAl ignColumn
              >> Inherits DataGridTextBox Column
              >>
              >> Private mTxtAlign As HorizontalAlign ment = HorizontalAlign ment.Left
              >> Private mDrawTxt As New StringFormat
              >>
              >> Protected Overloads Overrides Sub Edit(ByVal source As
              >> System.Windows. Forms.CurrencyM anager, ByVal rowNum As Integer, ByVal[/color]
              > bounds[color=green]
              >> As System.Drawing. Rectangle, ByVal [readOnly] As Boolean, ByVal[/color]
              > instantText[color=green]
              >> As String, ByVal cellIsVisible As Boolean)
              >> MyBase.Edit(sou rce, rowNum, bounds, [readOnly], instantText,
              >> cellIsVisible)
              >> MyBase.TextBox. TextAlign = mTxtAlign
              >> MyBase.TextBox. CharacterCasing = CharacterCasing .Upper
              >> End Sub
              >>
              >> Protected Overloads Overrides Sub Paint(ByVal g As
              >> System.Drawing. Graphics, ByVal bounds As System.Drawing. Rectangle, ByVal
              >> source As System.Windows. Forms.CurrencyM anager, ByVal rowNum As Integer,
              >> ByVal backBrush As System.Drawing. Brush, ByVal foreBrush As
              >> System.Drawing. Brush, ByVal alignToRight As Boolean)
              >> 'clear the cell
              >> g.FillRectangle (backBrush, bounds)
              >>
              >> 'draw the value
              >> Dim s As String
              >> If TypeOf Me.GetColumnVal ueAtRow([source], rowNum) Is Decimal
              >> Then
              >> s = CDec(Me.GetColu mnValueAtRow([source],
              >> rowNum)).ToStri ng(Me.Format)
              >> Else
              >> s = Me.GetColumnVal ueAtRow([source], rowNum).ToStrin g
              >> End If
              >> Dim r As Rectangle = bounds
              >> r.Inflate(0, -1)
              >> g.DrawString(s, MyBase.TextBox. Font, foreBrush,
              >> RectangleF.op_I mplicit(r), _
              >> mDrawTxt)
              >> End Sub
              >>
              >> Public Property DataAlignment() As HorizontalAlign ment
              >> Get
              >> Return mTxtAlign
              >> End Get
              >> Set(ByVal Value As HorizontalAlign ment)
              >> mTxtAlign = Value
              >> If mTxtAlign = HorizontalAlign ment.Center Then
              >> mDrawTxt.Alignm ent = StringAlignment .Center
              >> ElseIf mTxtAlign = HorizontalAlign ment.Right Then
              >> mDrawTxt.Alignm ent = StringAlignment .Far
              >> Else
              >> mDrawTxt.Alignm ent = StringAlignment .Near
              >> End If
              >> End Set
              >> End Property
              >>
              >> End Class
              >>
              >> Ken
              >> ---------------------
              >> "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
              >> news:OAEtgy9oFH A.3828@TK2MSFTN GP12.phx.gbl...[color=darkred]
              >> > Ken,
              >> > That works very well, leaving the header Left Aligned while setting the
              >> > Data
              >> > to Right Aligned.
              >> >
              >> > I merged it in with my Paint and Edit Overrides.
              >> >
              >> > It does however ignore the number formatting now.
              >> > I had the Format property set to :
              >> > .Format = ("#,##0.000 ;(#,##0.000) ;0.000 ")
              >> >
              >> >
              >> >
              >> > "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
              >> > news:%23OMRwO7o FHA.2472@tk2msf tngp13.phx.gbl. ..
              >> >> Hi,
              >> >>
              >> >>
              >> >[/color][/color]
              > http://www.windowsformsdatagridhelp....5-49bb9074a8bc[color=green][color=darkred]
              >> >>
              >> >> Ken
              >> >> ---------------
              >> >> "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
              >> >> news:%23BXV9k6o FHA.764@TK2MSFT NGP14.phx.gbl.. .
              >> >> > Hi
              >> >> > Does anyone know (or point me where I can find) how to set the
              >> >> > alignment
              >> >> > of
              >> >> > a DataGrid Column Header different to the alignment of the column.
              >> >> >
              >> >> > I am trying to show some Right aligned columns and the header looks
              >> > wrong
              >> >> > squashed to the right. If I could even add a trailing space but it
              >> >> > trims
              >> >> > any
              >> >> > trailing spaces off.
              >> >> >
              >> >> > Thanks
              >> >> >
              >> >> > Doug
              >> >> >
              >> >> >
              >> >>
              >> >>
              >> >
              >> >[/color]
              >>
              >>[/color]
              >
              >[/color]


              Comment

              • Doug Bell

                #8
                Re: DataGrid Col Header Alignment

                Ken,
                Thanks for your help.
                My Grid is working really well for this project.

                I will keep an eye on your site.

                Doug

                "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
                news:uR8rjq%23o FHA.2916@TK2MSF TNGP14.phx.gbl. ..[color=blue]
                > Hi,
                >
                > I need to add that functionality to the class. I havent come[/color]
                up[color=blue]
                > with the best method and will post an update when I do.
                >
                > Ken
                > -----------------
                > "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
                > news:%23Fi31K%2 3oFHA.3916@TK2M SFTNGP12.phx.gb l...[color=green]
                > > Ken,
                > > That still does not format the field.
                > > In that particular case, the Data Type is a Double and your code tests[/color][/color]
                for[color=blue][color=green]
                > > Decimal.
                > >
                > > So changing the code to:
                > > If TypeOf Me.GetColumnVal ueAtRow([source], rowNum) Is Double Then
                > >
                > >
                > > Works but If I wanted to make the code generic for all data types would[/color][/color]
                I[color=blue][color=green]
                > > have to use a Select and then format for each different type or is there[/color][/color]
                a[color=blue][color=green]
                > > more elegant way to make it generic?
                > >
                > > eg
                > > Select Case TypeOf Me.GetColumnVal ueAtRow([source], rowNum)
                > >
                > > Case Is Integer
                > >
                > > Case Is Double
                > >
                > > Case Is String
                > >
                > >
                > > "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
                > > news:%23wgw8$9o FHA.2156@TK2MSF TNGP14.phx.gbl. ..[color=darkred]
                > >> Hi,
                > >>
                > >> Here is an updated version
                > >>
                > >> Public Class HeaderAndDataAl ignColumn
                > >> Inherits DataGridTextBox Column
                > >>
                > >> Private mTxtAlign As HorizontalAlign ment = HorizontalAlign ment.Left
                > >> Private mDrawTxt As New StringFormat
                > >>
                > >> Protected Overloads Overrides Sub Edit(ByVal source As
                > >> System.Windows. Forms.CurrencyM anager, ByVal rowNum As Integer, ByVal[/color]
                > > bounds[color=darkred]
                > >> As System.Drawing. Rectangle, ByVal [readOnly] As Boolean, ByVal[/color]
                > > instantText[color=darkred]
                > >> As String, ByVal cellIsVisible As Boolean)
                > >> MyBase.Edit(sou rce, rowNum, bounds, [readOnly], instantText,
                > >> cellIsVisible)
                > >> MyBase.TextBox. TextAlign = mTxtAlign
                > >> MyBase.TextBox. CharacterCasing = CharacterCasing .Upper
                > >> End Sub
                > >>
                > >> Protected Overloads Overrides Sub Paint(ByVal g As
                > >> System.Drawing. Graphics, ByVal bounds As System.Drawing. Rectangle,[/color][/color][/color]
                ByVal[color=blue][color=green][color=darkred]
                > >> source As System.Windows. Forms.CurrencyM anager, ByVal rowNum As[/color][/color][/color]
                Integer,[color=blue][color=green][color=darkred]
                > >> ByVal backBrush As System.Drawing. Brush, ByVal foreBrush As
                > >> System.Drawing. Brush, ByVal alignToRight As Boolean)
                > >> 'clear the cell
                > >> g.FillRectangle (backBrush, bounds)
                > >>
                > >> 'draw the value
                > >> Dim s As String
                > >> If TypeOf Me.GetColumnVal ueAtRow([source], rowNum) Is Decimal
                > >> Then
                > >> s = CDec(Me.GetColu mnValueAtRow([source],
                > >> rowNum)).ToStri ng(Me.Format)
                > >> Else
                > >> s = Me.GetColumnVal ueAtRow([source], rowNum).ToStrin g
                > >> End If
                > >> Dim r As Rectangle = bounds
                > >> r.Inflate(0, -1)
                > >> g.DrawString(s, MyBase.TextBox. Font, foreBrush,
                > >> RectangleF.op_I mplicit(r), _
                > >> mDrawTxt)
                > >> End Sub
                > >>
                > >> Public Property DataAlignment() As HorizontalAlign ment
                > >> Get
                > >> Return mTxtAlign
                > >> End Get
                > >> Set(ByVal Value As HorizontalAlign ment)
                > >> mTxtAlign = Value
                > >> If mTxtAlign = HorizontalAlign ment.Center Then
                > >> mDrawTxt.Alignm ent = StringAlignment .Center
                > >> ElseIf mTxtAlign = HorizontalAlign ment.Right Then
                > >> mDrawTxt.Alignm ent = StringAlignment .Far
                > >> Else
                > >> mDrawTxt.Alignm ent = StringAlignment .Near
                > >> End If
                > >> End Set
                > >> End Property
                > >>
                > >> End Class
                > >>
                > >> Ken
                > >> ---------------------
                > >> "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
                > >> news:OAEtgy9oFH A.3828@TK2MSFTN GP12.phx.gbl...
                > >> > Ken,
                > >> > That works very well, leaving the header Left Aligned while setting[/color][/color][/color]
                the[color=blue][color=green][color=darkred]
                > >> > Data
                > >> > to Right Aligned.
                > >> >
                > >> > I merged it in with my Paint and Edit Overrides.
                > >> >
                > >> > It does however ignore the number formatting now.
                > >> > I had the Format property set to :
                > >> > .Format = ("#,##0.000 ;(#,##0.000) ;0.000 ")
                > >> >
                > >> >
                > >> >
                > >> > "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
                > >> > news:%23OMRwO7o FHA.2472@tk2msf tngp13.phx.gbl. ..
                > >> >> Hi,
                > >> >>
                > >> >>
                > >> >[/color]
                > >[/color][/color]
                http://www.windowsformsdatagridhelp....5-49bb9074a8bc[color=blue][color=green][color=darkred]
                > >> >>
                > >> >> Ken
                > >> >> ---------------
                > >> >> "Doug Bell" <PoorSupport@vo daphone.com.au> wrote in message
                > >> >> news:%23BXV9k6o FHA.764@TK2MSFT NGP14.phx.gbl.. .
                > >> >> > Hi
                > >> >> > Does anyone know (or point me where I can find) how to set the
                > >> >> > alignment
                > >> >> > of
                > >> >> > a DataGrid Column Header different to the alignment of the column.
                > >> >> >
                > >> >> > I am trying to show some Right aligned columns and the header[/color][/color][/color]
                looks[color=blue][color=green][color=darkred]
                > >> > wrong
                > >> >> > squashed to the right. If I could even add a trailing space but it
                > >> >> > trims
                > >> >> > any
                > >> >> > trailing spaces off.
                > >> >> >
                > >> >> > Thanks
                > >> >> >
                > >> >> > Doug
                > >> >> >
                > >> >> >
                > >> >>
                > >> >>
                > >> >
                > >> >
                > >>
                > >>[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                Working...