Einzelnen Beitrag anzeigen

MathiasSimmack
(Gast)

n/a Beiträge
 
#4
  Alt 16. Aug 2002, 19:29
Doch gibt es. Immerhin hat so ein TreeView oder StringGrid doch eine "Canvas". Ich habe mal ein altes Beispiel für eine StringGrid rausgekramt und die Teile rausgenommen, die dich wahrscheinlich nicht interessieren:

Code:
[b]procedure[/b] TMenuForm.sg2DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
[b]begin[/b]
  [color=#000080][i]// selection?[/i][/color]
  [b]if[/b](gdSelected [b]in[/b] State) [b]then[/b]
    [b]begin[/b]
      sg2.Canvas.Brush.Color := clHighlight;
      sg2.Canvas.Font.Color := clHighlightText;
    [b]end[/b]
  [b]else[/b]
    [b]begin[/b]
      sg2.Canvas.Brush.Color := clWindow;
      sg2.Canvas.Font.Color := clWindowText;
    [b]end[/b];

  [color=#000080][i]// draw text[/i][/color]
  [b]if[/b](lowercase(sg2.Cells[ACol,ARow]) = 'nil') [b]then[/b] sg2.Canvas.Font.Style := [fsBold]
    [b]else[/b] sg2.Canvas.Font.Style := [];

  sg2.Canvas.Textout(Rect.Left,
   (Rect.Bottom + Rect.Top - sg2.Canvas.TextHeight(sg2.Cells[ACol,ARow])) [b]div[/b] 2,
    sg2.Cells[ACol,ARow]);
[b]end[/b];
  Mit Zitat antworten Zitat