Autor Beitrag
Mike_C
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: So 23.03.03 18:46 
Hi!

Kann man bei einem DrawGrid eine einzelne Zelle mit einer bestimmten Farbe füllen?

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: So 23.03.03 19:27 
Ja.

Ich glaube aber nicht dass dir dieses >Ja< genügt. Du kannst mit (Sender as TDrawGrid).Canvas.FillRect(Rect) die Zelle füllen. Durch vorheriges Auswerten von ACol und ARow bestimmst du für welche Zellen die Füllung vorgenommen werden soll.

_________________
Ist Zeit wirklich Geld?
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 24.03.03 10:32 
Ein paar Code-Beispiele solltest Du durch die Suchfunktion finden.

Gruß
Tino
Mike_C Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Mo 24.03.03 12:40 
Titel: Versuch: Zelle füllen bei TDrawGrid
Also ich habe das mal so probiert:

ausblenden Quelltext
1:
2:
3:
4:
5:
  var Rect: TRect;
  
  DrawGrid1.Canvas.Brush.Color := clRed;
  Rect := DrawGrid1.CellRect(1,1);
  DrawGrid1.Canvas.FillRect(Rect);


Das fuktioniert zwar, aber nur, wenn ich einen Button anklicke. Kann man das auch so schreiben, dass sich die Zelle bei OnCreate oder OnShow füllt? Das funktioniert bei mir nämlich nicht.

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 24.03.03 12:49 
Tino hat dir doch gesagt, du sollst mal hier im Forum suchen.
dein Code gehört ins ondrawcellereignis, hättse mit der suche auch selber gefunden
Rect wird dabei schon übergeben, brauchst du nicht extra ermitteln

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Mike_C Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Mo 24.03.03 19:43 
Thx.

@Keldorn: Da lag ein Missverständniss vor. Ich war der Meinung, Tino meinte die Suchfunktion der Delphi-Hilfe :roll:

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?