Я делаю это таким образом:
unit Fcdgrid; interface usesSysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,Forms, Dialogs, Grids, DBGrids,DBCtrls, DB,Menus; typeTFixedColDBGrid = class(TDBGrid)privateFUserFixedCols : Integer;protectedprocedure LayoutChanged; override;procedure SetUserFixedCols(I:Integer); publishedproperty UserFixedCols: Integer read FUserFixedCols write SetUserFixedCols;end; procedure Register; implementation procedure Register;beginRegisterComponents('Data Controls', [TFixedColDBGrid]);end; procedure TFixedColDBGrid.LayoutChanged;begininherited LayoutChanged; { присваиваем FixedCols 1 если индикатор, иначе 0 }if ((inherited FixedCols + FUserFixedCols) < inherited ColCount) theninherited FixedCols := (FUserFixedCols + inherited FixedCols);end; procedure TFixedColDBGrid.SetUserFixedCols(I:Integer);beginFUserFixedCols := I;LayoutChanged;end; end |
Cheers [000569]