
Zitat von
Keldorn:
wo liegt da jetzt das Problem, ...
Hai Frank,
hauptsächlich wohl in der Überlegung wie man "markiert" das die Zahl gescannt wurde.
Dafür kann man einfach die Eigenschaft
Objects einer Zelle missbrauchen. In meinem Beispiel weise ich dieser via Castin einfach die Zahl 1 zu wenn es sich um eine gescannt Zahl handeln soll:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
ndx : Integer;
begin
for ndx := 1 to Pred (StringGrid1.RowCount) do
begin
StringGrid1.Cells[1,ndx] := IntToStr (ndx);
if ((ndx MOD 2) = 0) then
begin
StringGrid1.Objects [1,ndx] := TObject (1); // Jede zweite Zeile wurde "gescannt"
end;
end;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
fntsize : Integer;
begin
with (Sender As TStringGrid) do
begin
Canvas.Font.Size := 10;
Canvas.TextOut(Rect.Left + 2, Rect.Top + 1, Cells[ACol, ARow]);
if (Integer(StringGrid1.Objects[ACol,ARow]) = 1) then // Wenn "gescannt"
begin
Canvas.Font.Size := 8;
Canvas.TextOut(Rect.Left + 2, Rect.Top + 15 , 'Scan'); // Dann Info ausgeben
end;
end;
end;
Stephan B.
"Lasst den Gänsen ihre Füßchen"