Hello
Yes, you can.
Use DBGridEh.OnDrawTitleCell to draw title cell
DBGridEh.OnCellMouseClick to react title click
(dgColumnResize in OptionsEh should be disabled)
Code:
procedure TForm1.DBGridEh1CellMouseClick(Grid: TCustomGridEh; Cell: TGridCoord;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer;
var Processed: Boolean);
var
Column: TColumnEh;
begin
if (Cell.X >= 1) and (Cell.X < DBGridEh1.Columns.Count - 2) then
begin
Column := DBGridEh1.Columns[Cell.X - 1];
end
else
begin
Exit;
end;
if (Cell.Y = 0) and (Column.FieldName = 'DateTimeField1') then
begin
DBGridEh1.SelectedRows.SelectAll;
end;
end;
procedure TForm1.DBGridEh1DrawTitleCell(Grid: TCustomDBGridEh; ACanvas: TCanvas;
const ARect: TRect; Params: TDBGridDrawTitleCellParamsEh;
var Processed: Boolean);
var
ForeInsideRect: TRect;
CustomRect: TRect;
begin
if (Params.Column.FieldName = 'DateTimeField1') then
begin
Grid.DrawTitleCellBackground(ACanvas, ARect, Params);
ForeInsideRect := Params.ForeInsideRect;
CustomRect := Params.ForeInsideRect;
ForeInsideRect.Left := ForeInsideRect.Left + 20;
CustomRect.Right := ForeInsideRect.Left;
Params.ForeInsideRect := ForeInsideRect;
Grid.DrawTitleCellForeground(ACanvas, ARect, Params);
DrawCheckBoxEh(ACanvas.Handle, CustomRect, cbChecked, True, True, False, False);
Processed := True;
end;
end;