josephkim
2022-12-02T04:03:28Z
Hello Igor,

Thanks for the previous replies. Much appreciate it.

I have the following situation:


iGrid1.Cols.Add("The");
iGrid1.Cols.Add("Quick");
iGrid1.Cols.Add("Brown");
iGrid1.Cols.Add("Fox");
iGrid1.Cols.Add("Jumped");
iGrid1.Cols.Add("Over");
iGrid1.Cols.Add("The");
iGrid1.Cols.Add("Wall");
iGrid1.HScrollBar.Visibility = iGScrollBarVisibility.Always;
iGrid1.DoAutoResizeCols();

Based on what I assume the code should do is, it should resize the columns to the visible area and if the space is not wide enough, it should expand by allowing it to be scrolled until it has enough space to do so.

But unfortunately, I am unable to pull it off. Are there any way that will allow the control to resize as much as possible when given the scrollbar? Thanks! Hope I explained it clearly.
Igor/10Tec
2022-12-02T16:07:10Z
Your intention is not clear. Do you want to resize the control, i.e. iGrid?

The DoAutoResizeCols method changes the widths of all columns (once) so that the horizontal scroll bar is not needed. However, with your setting (Visibility set 'Always') the scroll bar remains on the screen and becomes disabled because there is no content to scroll in the horizontal direction.

Can you post a couple of screenshots demonstrating what you want to achieve?
josephkim
2022-12-03T05:37:13Z
I apologise for not being clear.

On an empty grid, with just columns only, even after calling DoAutoResizeCols(), there will still be columns that are not fully expanded out and will be clipped with "....".

What I am trying to achieve is, if scrollbar horizontal properties is set to Always, and calling DoAutoResizeCols(), it should expand out greedily, expanding the scrollbar if needed to ensure that the column names are fully expanded/visible and not covered by ".....".

Thanks!
Igor/10Tec
2022-12-03T06:44:08Z
Do you mean column titles (texts inside column headers) ended with ellipsis if there is no room to display them fully? Then you need the iGrid.Cols.AutoWidth() method.

Auto-reszing does a completely different thing - it guarantees that all columns will be entirely inside the viewport. You can find out more about all this in the manual. Read Section 3 'Managing Columns', the last 3 subsections.