Hallo beisammen,
wie kann ich in einem DBGrid das Verhalten der Option RowSelect nachbilden?
Ich möchte also, dass jede Zelle der aktuellen Zeile farblich markiert wird.
Hier habe ich mal meine Routine DrawColumnCell beigefügt - ich habe nur noch keinen Parameter gefunden, der mir anzeigt, ob die aktuelle Zeile auch selektiert ist.
Danke für jede Hilfe
und schöne Feiertage
Ralph
<PRE>
procedure TfmProPos.dbgPositionenDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
BrushColor, FontColor: TColor;
begin
// ***************************************
// Default-Farben
// ***************************************
BrushColor := clWindow;
FontColor := clBlack;
<p>
// ***************************************
// fokusierte Zeile markieren
// ***************************************
// if State = [gdFocused] then // funktioniert nicht
// if State = [gdSelected] then // funktioniert nicht
if <b>???</b> then
begin
BrushColor := clLtGray;
FontColor := clBlack;
end;
<p>
// ***************************************
// evtl. erste Spalte einfärben
// ***************************************
if Column.ID = 0 then
begin
case qyProPosAnzeigeTyp.Value of
2: BrushColor := clYellow;
3: BrushColor := clRed;
4: BrushColor := clFuchsia;
5: BrushColor := clLime;
end;
end;
<p>
// ***************************************
// Grid entsprechend einfärben
// ***************************************
dbgPositionen.Canvas.Brush.Color := BrushColor;
dbgPositionen.Canvas.Font.Color := FontColor;
dbgPositionen.DefaultDrawColumnCell(Rect, Datacol, Column, State);
end;
</PRE>
wie kann ich in einem DBGrid das Verhalten der Option RowSelect nachbilden?
Ich möchte also, dass jede Zelle der aktuellen Zeile farblich markiert wird.
Hier habe ich mal meine Routine DrawColumnCell beigefügt - ich habe nur noch keinen Parameter gefunden, der mir anzeigt, ob die aktuelle Zeile auch selektiert ist.
Danke für jede Hilfe
und schöne Feiertage
Ralph
<PRE>
procedure TfmProPos.dbgPositionenDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
BrushColor, FontColor: TColor;
begin
// ***************************************
// Default-Farben
// ***************************************
BrushColor := clWindow;
FontColor := clBlack;
<p>
// ***************************************
// fokusierte Zeile markieren
// ***************************************
// if State = [gdFocused] then // funktioniert nicht
// if State = [gdSelected] then // funktioniert nicht
if <b>???</b> then
begin
BrushColor := clLtGray;
FontColor := clBlack;
end;
<p>
// ***************************************
// evtl. erste Spalte einfärben
// ***************************************
if Column.ID = 0 then
begin
case qyProPosAnzeigeTyp.Value of
2: BrushColor := clYellow;
3: BrushColor := clRed;
4: BrushColor := clFuchsia;
5: BrushColor := clLime;
end;
end;
<p>
// ***************************************
// Grid entsprechend einfärben
// ***************************************
dbgPositionen.Canvas.Brush.Color := BrushColor;
dbgPositionen.Canvas.Font.Color := FontColor;
dbgPositionen.DefaultDrawColumnCell(Rect, Datacol, Column, State);
end;
</PRE>
Comment