How to create fixed columns in a TDBGrid (Views: 710)
Problem/Question/Abstract: How do I freeze Column 1 in place on a DBGrid? I found a FixedCols property for a TCustomGrid, but there doesn't seem to be anything for a DBGrid. Answer: If you put ... TFixColDBGrid = class(TDBGrid) protected property FixedCols; end; ... in your interface type section. And this ... TFixColDBGrid(DBGrid1).FixedCols := 2; ... in your FormCreate procedure, it will fix the first two columns (ie the indicator column and the first data column - if you have no indicator column, set it to 1). This is quite a good trick for simply exposing an ancestors property, particularly for complicated visual descendants with many properties which are set at design time. |