1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
| public aGridRect : TGridRect; procedure SetTempSchiff(aGridRect : TGridRect;i: Integer); end;
var Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.SetTempSchiff(aGridRect : TGridRect;i: Integer); var c,r : Integer; begin for c := aGridRect.Left to aGridRect.Right do for r := aGridRect.Top to aGridRect.Bottom do StringGrid1.Objects[c,r] := Pointer(i); end;
procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var c,r : Integer; begin StringGrid1.MouseToCell(X,Y,c,r); SetTempSchiff(aGridRect,0); aGridRect := TGridRect(Rect(c,r,c,r+5)); SetTempSchiff(aGridRect,1); end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer; Rect: TRect; State: TGridDrawState); begin if Integer(StringGrid1.Objects[aCol,aRow]) = 1 then StringGrid1.Canvas.Brush.Color := clRed else StringGrid1.Canvas.Brush.Color := StringGrid1.Color; StringGrid1.Canvas.Fillrect(Rect); end; |