This project is read-only.

SourceGrid width pb

Mar 15, 2010 at 9:14 AM

I have a source grid, and all columns size is calculated to fill the space of the whole area (i.e. each column width = data grid width / columns count);

But a problem occurs when I resize manually the width of some column. In this case, scroll bar appears (normally), but when I scroll to the right, big empty space appears between the right-most column and the right margin of the grid.

Any ideas how can I have always my columns filling all the space till the right margin, not having empty space there?



Mar 15, 2010 at 12:27 PM

I think the scroll bar algorithm ensures that the last column always will be visible if you scroll to the max right position.

So what you can do is actually expand the right most column that much, so that it looks like almost touching the right margin. This way it would visually look like it is expanded to fill all the space

Mar 15, 2010 at 2:50 PM

You are right - the scroll bar enables me to view the right most column when I scoll to the right most scroll bar position. But the problem is that in this case I see a lot of empty space (half of the screen) after the right most column.

I cannot expand my last column to fit that space, because I want my columns to have equal width, and if some column has width different from the others - this to be because the user has changed the width, and not because I've changed it from the software to fit the big empty space.

So, generally my question is: how to ensure that the scroll bar will scroll the right part of the screen, just enough to view the right-most column, and not more than this.

Mar 15, 2010 at 3:40 PM

I think it is not possible to achieve because of the algorithm.


The idea is that the scrolling is done based on row/column.     In your case, if you want to align the right most column with the right most position of the grid, would mean that the left most column can be left half-visible.   However, visibility is calculated based on columns, and thenn  scroll bars only with full-widths.

Actually i just tried, and open office calc works also the same. Personally, i would expect scrolling to be working on pixel, not row/column. However, the current algorithm is this and can not be changed in one hour.

Mar 15, 2010 at 5:15 PM

Ok, problem fixed. What needs to be done is to set the Maximum property of the HScrollBar to value, calculated based on the grid width and columns total width.

Mar 16, 2010 at 7:40 AM

Piminev, do you think it would be a good idea to put also an example in WindowsFormsSamples what you just did now?

Mar 16, 2010 at 9:44 PM

Hi, what is "WindowsFormsSamples" -  I did a quick search but couldn't find it ....

Mar 17, 2010 at 10:20 AM

Ah, I mean there is a project called SourceGrid.Examples     It was previously called WindowsFormsSamples :)

I suggest we could add another sample to that project, so that next time users would now how to achieve what you did here.  I