1. 2011. 4. 15. 01:42 IDE & SDK/Delphi
패널 추가시
uses 목록에 ExtCtrls 를 첨가 합니다. ( uses Window, SysUtils, .... ,ExtCtrls; )
귀찮다면 패널을 첨가하고 저장하면 자동 등록 됩니다 ( 단축키 : Ctrl + S )

- 일반사용 -
:글로벌 변수 등록
var
  pn: TPanel;

:이벤트 등록
  pn := TPanel.Create(Self);
  pn.Name := 'Panel1';//특별한 경우 없이는 생략 가능 합니다.
  pn.Parent := Self;
  pn.Left:=0;
  pn.Top:=0;
  pn.Width:=100;
  pn.Height:=100;
  pn.Visible := True;

- 빠른사용 -
with TPanel.Create(Self) do begiin
  Parent := Self;
  Name := 'Panel1';
  Left:=0;
  Top:=0;
  Width:=100;
  Height:=100;
  Visible := True;
end;

Tip : 객체 변수 없이 컨트롤 찾기.
사용 1 : TPanel(FindControl('Panel1'));
사용 2 : FindControl('Panel1') as TPanel;
function FindControl(Name:PChar):TControl;
var i : Cardinal;
begin
  with Form1 do
    for i := 0 to Components.Count -1 do begin
      if Components[i].Name = Name then
        Result := Components[i];
      end;
    end;
  end;
end;
Posted by Nightly Luna
,
® © Tanny Tales
/ rss