![]() |
onDrawColumnCell in DelphiXE2
Hallo,
ich initialisiere in onCreate ein 2 Dimensionales Array folgendermaßen:
Code:
in der OnDrawColumnCell eines DBGrids mache ich dann folgendes:type TZelle = (zFrei, zBesetzt); ... FGrid: array[0..200,0..32] of TZelle; .... for i := 0 to 200 do begin for j := 0 to 32 do begin FGrid[i][j]:= zFrei; end; end; FGrid[17][2] := zBesetzt;
Code:
Ich möchte also spezielle Felder des DBGrids anders einfärben. Welche eingefärbt werden sollen, kommen aus dem array FGrid.
...
var rec : TRect; zeile : Integer; zelle: TZelle; begin rec := Rect; with (Sender as TDBGrid) do begin zeile := DataSource.DataSet.RecNo; zelle := FGrid[zeile][DataCol]; if (not (gdSelected in State) and(DataCol <> 0)) then begin if zelle = zBesetzt then begin Canvas.Brush.Color := clRed; Canvas.FillRect(rec); end; end; Canvas.TextOut(rec.Left + 2, rec.Top + 1, Column.Field.AsString); //Denn Text in der Zelle ausgeben end; Leider wird in diesem Beispiel nicht nur die Zelle[17,2] eingefärbt, sondern auch noch 2 weitere Zellen. Kann mir jemand sagen, woran das liegen könnte? Vielen Dank. gruß mc |
Alle Zeitangaben in WEZ +1. Es ist jetzt 14: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-2025 by Thomas Breitkreuz