Results 1 to 3 of 3

Thread: DataGridView question - extra space showing on headertext

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2014
    Posts
    63

    DataGridView question - extra space showing on headertext

    I have a design-oriented question about the DataGridView control. I have a DataGridView with several columns set at design time. The column.AutoSizeMode is set to ColumnHeader. As expected, this results in the columns being sized to the width needed to show the text of the column header.

    But there is a large amount of dead space after the text of the column header that I can't seem to get rid of and that also unnecessarily increases the column width – please see the attached image.

    Does anyone know what setting controls this extra space?

    Name:  dgv Image.png
Views: 244
Size:  4.0 KB

  2. #2

    Thread Starter
    Member
    Join Date
    Aug 2014
    Posts
    63

    Re: DataGridView question - extra space showing on headertext

    I should have continued my hour long search a bit longer... this uniform space is where the sorting glyph appears when the column is sortable.

    Here's a post on the subject on Stackoverflow with a rather intriguing solution posted by flodis. The post and solution is for c# but could be adapted for vb.net.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: DataGridView question - extra space showing on headertext

    Is your issue resolved? If so, please use the Thread Tools menu to mark the thread Resolved so that we can see that you don't need any further help without opening the thread and reading both posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width