Registriert seit: 1. Feb 2018
3.691 Beiträge
Delphi 11 Alexandria
|
AW: von ComboBox abgeleitete Komponente
23. Sep 2022, 16:49
Delphi-Quellcode:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Menus;
type
TXComboBox = class(TComboBox)
strict private
FPopupMenu: TPopupMenu;
public
constructor Create(AOwner: TComponent); override;
public
property PopupMenu: TPopupMenu read FPopupMenu write FPopupMenu;
end;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
FComboBox: TXComboBox;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
constructor TXComboBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Parent := TWinControl(AOwner);
FPopupMenu := nil;
Items.Add(' Foo');
Items.Add(' Bar');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FComboBox := TXComboBox.Create(Self);
FComboBox.Left := 10;
FComboBox.Top := 10;
end;
end.
Eventuell so?
|
|
Zitat
|