Re: DataGridView: last column can be made smaller but not bigger

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks, I hadn't thought of that. I'll probably still try to implement the
resizing by dragging, because the current behaviour seems counterintuitive to
me, but at least I have a workaround now :-)

"MikeM" wrote:

Hello - I ran into the same issue but it's easily resolved. Inherant to the
DataGridView is the ability to have it autosize it's columns just by
double-clicking on the column header. To do so, position the mouse to the
right side of the column you want to resize and double click when you get the
column width change cursor.

Mike


"RafGeens" wrote:

I feared as much :-) Thanks for the reply, I'll try something like that when
I revisit the problem. If I find a concrete solution I'll post it back here.

Raf

"Richard Coltrane" wrote:

Hi there,

I dont know off the top of my head. I had a quick look just now and i see
your problem. I would have thought some of the border/column properties etc
would have allowed an easy override of this restriction. Obviously resizing
is possible but it looks like you might to bake your own. Perhaps something
like

OnGridMouseDown()
if (cursor == widthchange cursor) and (mousepos=gridrightedgepos) then
lastcolwidth +=1;

??

Richard


"RafGeens" <RafGeens@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:335F88DB-FCA3-416A-B57C-2EF1899200C1@xxxxxxxxxxxxxxxx
Hi,

I have a DataGridView control where the user can resize the columns. The
control is embedded inside a Panel. When clicking on and dragging the
column
seperator to the right of the rightmost column, I can make the column
smaller
when I move it to the left. If I try to move it to the right however, my
cursor is halted against the edge of the control. So the column can't be
made
bigger.

This can be reproduced in the sample at
http://msdn2.microsoft.com/en-us/library/1x64c23x.aspx by clicking
Customer->View Orders in the main form and doing it on the table that
appears. In that sample, it is possible to make the last column bigger
again
by making the whole window bigger, until its length is more than the total
length of the columns, creating an open space between the columns and the
edge of the window. Then the right seperator of the rightmost column can
be
dragged freely, up until the edge of the window.

However, this trick isn't practical in my own control, since the control
is
too small and the total column length too long.

Is there some standard way to make it behave like the list view in
Explorer,
where you can resize past the border of the window?

Kind regards,
Raf



.



Relevant Pages

  • Re: DataGridView: last column can be made smaller but not bigger
    ... column width change cursor. ... I have a DataGridView control where the user can resize the columns. ... edge of the window. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Drawing in CHtmlView
    ... represent the other person's cursor, so this cursor is what I want to draw ... other person's browser. ... All the drawing is done by and in that control. ... In order to draw something in that window you will have to replace that ...
    (microsoft.public.vc.mfc)
  • Re: Drawing in CHtmlView
    ... represent the other person's cursor, so this cursor is what I want to draw ... other person's browser. ... All the drawing is done by and in that control. ... In order to draw something in that window you will have to replace that ...
    (microsoft.public.vc.mfc)
  • Re: DataGridView: last column can be made smaller but not bigger
    ... I have a DataGridView control where the user can resize the columns. ... it is possible to make the last column bigger ... edge of the window. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: repeat key
    ... whatever, press the control ... key while dragging, the cursor will have a + sign, this will produce a ... duplicate. ...
    (microsoft.public.publisher)