| Цитата(Pakshin @ 13.11.2004, 04:50) | Попробуй:
| Код | procedure TForm1.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin case Button of mbLeft: StringGrid1.Cells[StringGrid1.Col, StringGrid1.Row]:='1'; mbLeft: StringGrid1.Cells[StringGrid1.Col, StringGrid1.Row]:='0'; end end;
| |
А можно в одну строчку
| Код | procedure TForm1.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin StringGrid1.Cells[StringGrid1.Col, StringGrid1.Row] := IntToStr(Integer(not Boolean(Button))); end;
|
Или даже так, если не хочется использовать InToStr:
| Код | procedure TForm1.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin StringGrid1.Cells[StringGrid1.Col, StringGrid1.Row] := Chr(Integer(not Boolean(Button)) + 48); end;
| |