본문 바로가기
Delphi Tip/컴포넌트

컴포넌튼 만들기(초간단)

by MonoSoft 2023. 11. 29.
728x90
반응형

컴포넌튼 만들기

 

 

TLabel 을 상속받어, 기본 Default 배경이 검은색으로 설정되는 컴포넌트입니다.

 

unit BlackLabel;

 

interface

 

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;

 

type

TBlackLabel = class(TLabel)

  private

  { Private declarations }

  protected

  { Protected declarations }

  public

    constructor create(aOwner: TComponent); override;

  published

  { Published declarations }

end;

 

procedure Register;

 

implementation

 

procedure Register;

begin

  RegisterComponents('Samples', [TBlackLabel]);

end;

 

constructor TBlackLabel.create;

begin

  inherited Create(aOwner);

 

  Color:=clBlack;

  Font.Color:=clWhite;

end;

 

728x90
반응형

댓글