Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Combobox eigenbau (https://www.delphipraxis.net/151305-combobox-eigenbau.html)

WM_CLOSE 12. Mai 2010 08:11


Combobox eigenbau
 
Hallo DP gemeinde,

Ich hoffe ihr könnt mir bei folgendem Problem helfen:

Ich bin gerade dabei eine Combobox-Komponente zu schreiben,
bei der man schon im OI festlegen kann, welche Elemente aktiviert
und welche deaktiviert(grau) sein sollen. Die Elemente habe ich
als Objekte in der Combobox gespeichert(als property).
Die Auswahl im OI funktioniert schon, aber die Elemente
werden nicht angezeigt

Hier der Code der DrawItem Methode

Delphi-Quellcode:
procedure TCustomSpzComboBox.DrawItem(Index: Integer; Rect: TRect;
  State: TOwnerDrawState);
begin
  TControlCanvas(Canvas).UpdateTextFlags;
  if Assigned(OnDrawItem) then
    OnDrawItem(Self, Index, Rect, State)
  else
  begin
    Canvas.FillRect(Rect); //FSpzItems ist eine TCollection
    if not TSpzItem(FSpzItems.Items[Index]).Enabled then
      Canvas.Font.Color:=clSilver;
    if Index >= 0 then
      Canvas.TextOut(Rect.Left + 2, Rect.Top, TSpzItem(SpzItems.items[Index]).name);
  end;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:24 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz