make first column always visible?
I have an application (winforms, c#) that displays data in a Listview in a very usual way - the first row is headers, the first column in each row is header and the following sub-items is the data itself.
I want the first column (the headers columns) always visible and the horizontal scroll to affect the other columns only.
i don't think it is possible in winforms listview (am i wrong?). Hence, i'm thinking to split the listview to two listviews - one for headers and the second for data. In that case, i need to connect the vertical scroll bars - a task which i find to be harder than i've expected.
Am i taking a wrong path (eg would it be easier to use a different control)? If not, any pointers on how to implement it?
Note: Winforms Listview has poor API (eg no scrolling event) and is known as buggy, so i'm looking a working sample rather than MSDN links...
Thanks
As already noted the DataGridView supports this behaviour, but nobody told how this will be done:
To enable this feature simply set the Frozen
property of a column. Further informations can also be found in this How to: Freeze Columns in the Windows Forms DataGridView Control.
I think you have to try to use the DatagridView instead of the listbox. As far as I know, the DataGridView supports this.
Did you try using DataGridView instead?
Edit:
In case you run into problems with setting row headers text, take a look at this post (basically, you set row header text upon item being added to grid).
链接地址: http://www.djcxy.com/p/27822.html上一篇: 溢出菜单大小
下一篇: 使第一列始终可见?