Mega Code Archive

 
Categories / Delphi / Examples
 

Dbgrid fixed leftmost column

Question: How do I make the leftmost column in my DBGrid fixed, so it stays when I scroll left and right in the grid? Answer: Declare a type THack = class(TDBGrid). Then in run-time, do THack(DBGrid1).FixedCols := 2. Of course, you'd have to set it to 1 if you exclude dgIndicator from the Options in the grid component.