AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

StringGrid: eine Zeile markieren?

Ein Thema von Helmi · begonnen am 2. Jan 2006 · letzter Beitrag vom 2. Jan 2006
 
Benutzerbild von Helmi
Helmi

Registriert seit: 29. Dez 2003
Ort: Erding, Republik Bayern
3.344 Beiträge
 
Delphi XE2 Professional
 
#8

Re: StringGrid: eine Zeile markieren?

  Alt 2. Jan 2006, 23:07
Im OnDrawCell mach ich folgendes:

Delphi-Quellcode:
procedure TMainForm.StringGrid_AblaufDrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
  with (Sender as TStringGrid), Canvas do
    begin
      //linke, obere Zelle
      if (ACol = 0) and (ARow = 0) then
        begin
          Brush.Color := clWhite;
        end;

      //erste Zeile und erste Spalte neu zeichnen
      if (ACol = 0) or (ARow = 0) then
        begin
          //Textfarbe Blau
          Font.Color := clBlue;
          Font.Height := 16;
          Font.Style := [fsBold];
          TextRect(Rect, Rect.Left + 2, Rect.Top + 2, cells[acol, arow]);
          FrameRect(Rect);
        end
      else
        begin
          //Hintergrundfarbe Weiss
          Brush.Color := clwhite;

          //Textfarbe Schwarz
          Font.Color := clBlack;
          Font.Height := 12;
          Font.Style := [fsBold];
          TextRect(Rect, Rect.Left + 2, Rect.Top + 2, cells[acol, arow]);
          FrameRect(Rect);
        end;

      //
      If (ARow > 0) and (ACol > 1) and (ACol < 11) then
        If Cells[ACol, ARow] <> 'then
          begin
            case Cells[ACol, ARow][1] of
              '1': begin
                      //Hintergrund-Farbe "rot" bei Relais einschalten
                      Canvas.Brush.Color := clRed;
                    end;
              '0': begin
                      //Hintergrund-Farbe "rot" bei Relais einschalten
                      Canvas.Brush.Color := clLime;
                    end;
              '?': begin
                      //Hintergrund-Farbe "rot" bei Relais einschalten
                      Canvas.Brush.Color := clYellow;
                    end;
            else
              //Hintergrund-Farbe "weiss"
              Canvas.Brush.Color := clWhite;
            end;

            TextRect(Rect, Rect.Left + 2, Rect.Top + 2, cells[acol, arow]);
            FrameRect(Rect);
          end;
    end;
end;
mfg
Helmi

>> Theorie ist Wissen, dass nicht funktioniert - Praxis ist, wenn alles funktioniert und keiner weiss warum! <<
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:01 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz