Einzelnen Beitrag anzeigen

omata

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

Re: StrinGrid Feldinhalt wird "Unsichtbar"

  Alt 9. Aug 2005, 17:42
Moin,

und das würde z.B. so aussehen...

Delphi-Quellcode:
  with Sender as TStringGrid do begin
    dy := (Rect.Bottom-Rect.Top-Canvas.TextHeight(Cells[ACol, ARow])) div 2;
    dx := (Rect.Right-Rect.Left-Canvas.TextWidth(Cells[ACol, ARow])) div 2;

    if (acol = 0) or (arow = 0) then begin
      Canvas.Brush.Color := clBtnFace;
      Canvas.FillRect(Rect);
      Canvas.TextOut(Rect.Left+dx, Rect.Top+dy, Cells[ACol, ARow]);
    end
    else begin
      if gdFocused in State then begin
        //Markierter Bereich
      end
      else if gdSelected in State then begin
        Canvas.Brush.Color := clHighlight;
        Canvas.Font.Color:=clWindow;
      end
      else begin
        Canvas.Brush.Color := clWindow;
      end;

      Canvas.FillRect(Rect);
      Canvas.TextOut(Rect.Left+dx, Rect.Top+dy, Cells[ACol, ARow]);
    end;
  end;
MfG
Thorsten
  Mit Zitat antworten Zitat