unit untfmeFragen;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DBCtrls;
type
TfmeFragen = class(TFrame)
procedure LadeFme(Sender:TObject);
procedure ComboBoxDrawItem1(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
procedure ComboBoxDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
implementation
{$R *.dfm}
var
RunTimeCombo : array of TComboBox;
procedure TfmeFragen.LadeFme(Sender:TObject);
var x:integer;
begin
SetLength(RunTimeCombo,1);
for x:=0 to length(Runtimecombo)-1 do
begin
RunTimeCombo[x]:=TComboBox.Create(Sender as TFrame);
With RunTimeCombo[x] do
begin
Parent := (Sender as TFrame);
Left := 10;
Top :=10;
Width:=100;
Style := csOwnerDrawFixed;
ondrawitem := ComboBoxDrawItem;
DroppedDown := true;
end;
end;
end;
procedure TfmeFragen.ComboBoxDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin
//hier den Verweis auf das Draw bringen
ComboBoxDrawItem1(Control,Index,Rect,State);
end;
procedure TfmeFragen.ComboBoxDrawItem1(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin
//
with (Control as TCombobox) do
begin
(Control as TCombobox).Canvas.Brush.Color:=clRed;
(Control as TCombobox).Canvas.FillRect(Rect);
end;
end;
end.