Datagridview - check if the last column is fully displayed

I was wondering if there is a way to determine if the last column is displayed.

I know the column has a Displayed property, but this property is true if the column is partially or completely displayed. I just want the column to be fully rendered.

+1


source to share


1 answer


This will be done:

Function IsFullyVisible(ByVal dg As DataGridView, ByVal columnindex As Integer) As Boolean  

    Return dg.GetColumnDisplayRectangle(columnindex, False).Width = dg.GetColumnDisplayRectangle(columnindex, True).Width

End Function

      



Call it IsFullyVisible (DataGridView1, DataGridView1.ColumnCount - 1) to get if the last column is fully visible.

+1


source







All Articles