Jump to content

Alinhamento Datagrid


Recommended Posts

Posted

Como posso resolver este problema de alinhamento ?  :wallbash:

http://img7.imageshack.us/img7/4479/alinhamento.png

Obrigado

Posted

Olá,

Podes fazer algo do género (onde o Cells(2) é o index da coluna), definindo um Style.Alignment individualmente paracada célula:

        For Each row As DataGridViewRow In Me.DataGridView1.Rows
            If Not row.IsNewRow Then

                If row.Index Mod 2 Then
                    row.Cells(2).Style.Alignment = DataGridViewContentAlignment.MiddleLeft
                Else
                    row.Cells(2).Style.Alignment = DataGridViewContentAlignment.MiddleRight
                End If
               
            End If
        Next
Posted

Olá,

Podes fazer algo do género (onde o Cells(2) é o index da coluna), definindo um Style.Alignment individualmente paracada célula:

        For Each row As DataGridViewRow In Me.DataGridView1.Rows
            If Not row.IsNewRow Then

                If row.Index Mod 2 Then
                    row.Cells(2).Style.Alignment = DataGridViewContentAlignment.MiddleLeft
                Else
                    row.Cells(2).Style.Alignment = DataGridViewContentAlignment.MiddleRight
                End If
               
            End If
        Next

Obrigado  😛

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.