Hello
Look at the Demo project \Demos\DBGridEh.TreeView.Solutions\
It have section 'Checkboxes in a Tree' (File FrameFour.pas).
Attachment:
sshot-128.png [ 75.44 KiB | Viewed 2192 times ]
Checkboxes are displayed in grid cells using images from the ImageList component.
To display a picture from the ImageList component, you need to make the following settings in the column.
Column.ImageList = ImageList1
Column.ShowImageAndText = True
Column.TextEditing = False
Write Column.OnGetCellParams event handle where image index is assigned to Params.ImageIndex for every record of DataSet.
Code:
procedure TfrFrameFour.DBGridEh1Columns0GetCellParams(Sender: TObject;
EditMode: Boolean; Params: TColCellParamsEh);
begin
Params.ImageIndex := MemTableEh1.FieldByName('ImageIndex').AsInteger;
end;
In this example, the picture number is already stored in the DafaSet field - ImageIndex.
-----
About drawing the Plus / Minus tree icons.
Unfortunately, this function is hardcoded.
You need to rewrite the function
procedure TCustomDBGridEh.DrawGridTreeElement.