Einzelnen Beitrag anzeigen

omata

Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
 
Delphi 7 Enterprise
 
#2

Re: String Grid - Klick auf Fixed Felder

  Alt 17. Dez 2004, 00:58
Moin,

hoffe das hilft dir...

Delphi-Quellcode:
procedure TForm.FormCreate(Sender: TObject);
var GridRect:TGridRect;
begin
  with GridRect do begin
    Left:=-1;
    Right:=-1;
    Top:=-1;
    Bottom:=-1;
  end;
  StringGrid.Selection:=GridRect;
end;

procedure TForm.StringGridMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var Col, Row:integer;
    GridRect:TGridRect;
    StringGrid:TStringGrid;
begin
  if Sender is TStringGrid then begin
    StringGrid:=TStringGrid(Sender);
    StringGrid.MouseToCell(X, Y, Col, Row);
    if (Col >= 0) and (Row >= 0) then begin
      GridRect.Left:=0;
      GridRect.Right:=StringGrid.ColCount;
      GridRect.Top:=Row;
      GridRect.Bottom:=Row;
      StringGrid.Selection:=GridRect;
    end;
  end;
end;

procedure TForm.StringGridSelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  CanSelect:=false;
end;
MfG
Thorsten
  Mit Zitat antworten Zitat