|
-
Aug 10th, 2011, 02:42 PM
#1
Thread Starter
Frenzied Member
Datagridview AllowUserToResizeColumns not working

I have some code written by another developer (no, really). The datagridview has the AllowUserToResizeColumns property set to true, but at runtime the grid will not allow column resizing. I've checked the code to see if the property is being set in code and I can't find anything. Is there some other grid property that, if set to a certain value, will disable column resizing?
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Jan 26th, 2012, 10:37 AM
#2
Thread Starter
Frenzied Member
Re: Datagridview AllowUserToResizeColumns not working
I never got an answer to this post, and subsequently forgot about the issue. Well, today I ran into it again and went on the web to search for an answer, and the first page that came up in my search was my original post.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Jan 26th, 2012, 12:56 PM
#3
Thread Starter
Frenzied Member
Re: Datagridview AllowUserToResizeColumns not working
So I read the following on a microsoft website:
Columns in fill mode divide the available control width in proportions indicated by their FillWeight property values. The width available for fill mode is determined by subtracting the widths of all other columns from the width of the client area of the control. If this width is smaller than the combined MinimumWidth values of all fill-mode columns, the horizontal scroll bar is displayed, all fill-mode columns are shown with their minimum widths, and user column-resizing is disabled.
Since I'm setting the AutoSizeColumnsMode property to 'AllCells', that seems to be disabling the column-resizing.
So now the question is: How do if fix it? I can, of course, change the AutoSizeColumnsMode property, but that will lead to a less ideal user experience.
Any ideas welcome.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Nov 19th, 2018, 10:23 PM
#4
Junior Member
Re: Datagridview AllowUserToResizeColumns not working
I know this is an old post, but thought I'd add this in case anyone else is still looking for the solution like I was.
Dolot, you were right that setting the AutoSizeColumnsMode property to 'AllCells' was disabling column-resizing. This documentation says that any automatic sizing of columns disables the user's ability to alter column width. I found that setting both the column's autosizemode to 'NotSet' (the default), and also the datagridview's Autosizecolumnsmode to 'None' and then using the datagridview.autoresizecolumns method should accomplish the trick. It allows the user to reset the size, but formats the size to fit the data.
-
Nov 19th, 2018, 10:25 PM
#5
Junior Member
Re: Datagridview AllowUserToResizeColumns not working
Last edited by Greydog1; Nov 19th, 2018 at 10:27 PM.
Reason: duplicate post
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|