Einzelnen Beitrag anzeigen

edmu

Registriert seit: 27. Jul 2004
41 Beiträge
 
#9

Re: Stringgrid Markierung deaktivieren

  Alt 14. Feb 2007, 04:47
hallo,
probiert es mal so.

Delphi-Quellcode:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var GR:TGridRect;
begin
  with StringGrid1 do
  begin
    if gdFixed in State
      then Canvas.Brush.Color := FixedColor
      else Canvas.Brush.Color := Color;
    Rect.Top := Rect.Top + 1;
    Rect.Left := Rect.Left + 1;
    Rect.Right := Rect.Right - 1;
    Rect.Bottom := Rect.Bottom - 1;
    Canvas.FillRect(Rect);
    Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[ACol, ARow]);
    if gdFocused in State
      then Canvas.DrawFocusRect(Rect);


  end;

end;

procedure TForm1.StringGrid1Exit(Sender: TObject);
var GR:TGridRect;
begin
    with GR do begin
    GR.Left:=0;
    GR.Right:=0;
    GR.Top:=0;
    GR.Bottom:=0;
    end;
    StringGrid1.Selection:=GR;

end;
beim verlassen des stringgrid das ereignis exit ausführen
  Mit Zitat antworten Zitat