Q&A

  • Panel에 Glyph는 어떻게 추가합니까?
Panel에 Glyph를 추가하고 싶은데요.



물론 컴포넌트를 만들어야 겠지만, 어떻게 추가시키는지 알려주세요...



부탁드립니다.

1  COMMENTS
  • Profile
    jinifan 1999.10.07 05:16
    엄청 간단 예제 임니당...



    by jinifan...



    unit GPanel;



    interface



    uses

    Windows, Messages, SysUtils, Classes, Graphics, Controls, ExtCtrls;



    type

    TGlyphPanel = class(TPanel)

    private

    { Private declarations }

    FGlyph: TBitmap;

    procedure SetGlyph(Bmp: TBitmap);

    protected

    { Protected declarations }

    procedure Paint; override;

    public

    { Public declarations }

    constructor Create(AOwner: TComponent); override;

    destructor Destroy; override;

    property Canvas;

    published

    { Published declarations }

    property Glyph: TBitmap read FGlyph write SetGlyph;

    end;



    procedure Register;



    implementation



    constructor TGlyphPanel.Create(AOwner: TComponent);

    begin

    inherited Create(AOwner);

    FGlyph:= TBitmap.Create;

    end;



    destructor TGlyphPanel.Destroy;

    begin

    FGlyph.Free;

    inherited Destroy;

    end;



    procedure TGlyphPanel.Paint;

    begin

    inherited;

    if FGlyph.Empty then Exit;

    Canvas.Draw(2, 2, FGlyph);

    end;



    procedure TGlyphPanel.SetGlyph(Bmp: TBitmap);

    begin

    FGlyph.Assign(Bmp);

    Invalidate;

    end;



    procedure Register;

    begin

    RegisterComponents('Jinifan', [TGlyphPanel]);

    end;



    end.



    David wrote:

    > Panel에 Glyph를 추가하고 싶은데요.

    >

    > 물론 컴포넌트를 만들어야 겠지만, 어떻게 추가시키는지 알려주세요...

    >

    > 부탁드립니다.