PC Review


Reply
Thread Tools Rate Thread

DataGridView - user sizing columns

 
 
proxyuser
Guest
Posts: n/a
 
      15th Sep 2009
I have AllowUserToResizeColumns = true. AutoSizeColumnsMode is set to
AllCells. When the grid is displayed with data, the columns are not
resizable with the mouse. Any ideas?


 
Reply With Quote
 
 
 
 
Jack Jackson
Guest
Posts: n/a
 
      15th Sep 2009
On Tue, 15 Sep 2009 10:46:10 -0400, "proxyuser" <(E-Mail Removed)>
wrote:

>I have AllowUserToResizeColumns = true. AutoSizeColumnsMode is set to
>AllCells. When the grid is displayed with data, the columns are not
>resizable with the mouse. Any ideas?
>


If you set AutoSizeColumnsMode to AllCells, then each cell will always
be the width necessary to display and it makes no sense to allow the
user to resize the columns since they are constrained to be a fixed
size.

It depends what you want to do. I suppose you want the grid columns
to initially be sized to exactly fit the data, but then allow the user
to later change it.

What I usually do is to set the columns that are relatively narrow to
AllCells, and the larger ones to size to a percentage of the remaining
space, which allows the user to change those columns.
 
Reply With Quote
 
proxyuser
Guest
Posts: n/a
 
      15th Sep 2009

"Jack Jackson" <jjackson-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> It depends what you want to do. I suppose you want the grid columns
> to initially be sized to exactly fit the data, but then allow the user
> to later change it.


Exactly. I didn't know AllCells constrained it.

> What I usually do is to set the columns that are relatively narrow to
> AllCells, and the larger ones to size to a percentage of the remaining
> space, which allows the user to change those columns.


The grid is showing dynamic data, and I don't know that columns or sizes at
dev time. Also, we'll be virtualizing it, so I don't really want to waste
much run time calculating all the column data widths.


 
Reply With Quote
 
Jack Jackson
Guest
Posts: n/a
 
      16th Sep 2009
On Tue, 15 Sep 2009 13:52:39 -0400, "proxyuser" <(E-Mail Removed)>
wrote:

>
>"Jack Jackson" <jjackson-(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>>
>> It depends what you want to do. I suppose you want the grid columns
>> to initially be sized to exactly fit the data, but then allow the user
>> to later change it.

>
>Exactly. I didn't know AllCells constrained it.
>
>> What I usually do is to set the columns that are relatively narrow to
>> AllCells, and the larger ones to size to a percentage of the remaining
>> space, which allows the user to change those columns.

>
>The grid is showing dynamic data, and I don't know that columns or sizes at
>dev time. Also, we'll be virtualizing it, so I don't really want to waste
>much run time calculating all the column data widths.
>


Then I wouldn't autosize to the size of the current data. Instead I
would make a guess as to which columns need to be wider than others
and set each to a proportion of the grid width.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control Instance/DataGridView.Columns in Visual Studio Design =?Utf-8?B?U29yaW4gRG9saGE=?= Microsoft Dot NET Framework Forms 23 22nd Jan 2010 03:38 PM
Re: User Control Instance/DataGridView.Columns in Visual Studio De Peter Hansson Microsoft Dot NET Framework Forms 0 8th Jan 2010 09:14 AM
Dynamic update (preview) when re-sizing column in DataGridView miikka Microsoft C# .NET 0 13th Mar 2008 01:18 PM
problem sizing a DataGridView Jeff Microsoft C# .NET 1 15th Oct 2007 10:40 PM
how to set the datagridview columns to allow user to click to sort AboutJAV@gmail.com Microsoft Dot NET Framework Forms 3 8th Sep 2007 02:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:50 AM.