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

Tech-Archive recommends: Fix windows errors by optimizing your registry



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: How do you use an unbound DataAdapter?
    ... You told that you have used DataAdapter (in the way as you use it a kind of ... You have used the word GridView often (a webform control) where you where ... automaticly a DataGridView and toolstrip etc. ... On the left side of the IDE is a Window, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How do you use an unbound DataAdapter?
    ... On the left side of the IDE is a Window, ... Now if you drag a table to the Windows Form you get a DataGridView control ... Or you should mean a DataAdapter that is used to ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Solution to Form initial display issue
    ... Rod wrote: ... Specify the WindowState property on the child form to be ... Anchoring is more about fixing the distance a control is from the ... These child forms generally contain a DataGridView control with the ...
    (microsoft.public.dotnet.framework.windowsforms)
  • 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. ... When clicking on and dragging the ... 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)