Hallo,
@Bummi: Sieht schön schlank aus!
macha' s ganz rund und spendieren wir dem TE noch die SelectCell (so als Wiedergutmachung)
Delphi-Quellcode:
type
TStringGrid = class(Grids.TStringGrid)
procedure WMCommand (var Message: TWMCommand); message WM_COMMAND;
private
FCheckBox: TCheckBox;
procedure SetCheckBox (const Value: TCheckBox);
protected
function SelectCell (ACol, ARow: Longint): Boolean; override;
published
property CheckBox: TCheckBox read FCheckBox write SetCheckBox;
end;
und
Delphi-Quellcode:
function TStringGrid.SelectCell (ACol: Integer; ARow: Integer) : Boolean;
var
r : TRect;
p : TPoint;
begin
if (ACol = 5) AND (ARow >= FixedRows) then
begin
Perform (WM_CANCELMODE, 0, 0);
r := CellRect(ACol, ARow);
p := ScreenToClient (ClientToScreen (r.TopLeft));
with FCheckBox do
begin
BringToFront;
SetBounds(p.X + 17, p.Y + 5, 13, 13);
Visible := True;
SetFocus
end
end;
Result := inherited SelectCell (ACol, ARow)
end;
Rest wie gehabt.
Gruß