Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[1033] [답변] JEDOSON/콘트롤을 폼상에서 실행시 동적으로 생
longdr [ ] 1896 읽음    1998-02-01 19:43
안녕하세요... 댁스터입니다...

컨트롤을 동적으로 생성하시려면 먼저... 선언부에 선언을 하셔야죠...

예를 들어 버튼 컨트롤로 하죠...    먼저 TButton이 선언된 유닛을

uses절에 추가합니다... uses  stdctrls;

그리고, 동적으로 만들 버튼을 선언합니다.

    MyBtn: TButton;

그리고 다음과 같이 합니다....

  MyBtn := TButton.Create(Self);   // 버튼을 생성합니다..
  with MyBtn do begin                  
    Parent := Self;                         // 아래설명 참고
    Left := 100;                             // 버튼의 속성을 정의한다.  
    Top := 100;                             //        "              "
    Caption := 'test';                     //        "              "
  end;

요렇게 하면 위 코드가 작성되어 있는 이벤트 헨들러가
실행될 때 버튼이 생깁니다..

그리고 Parent 속성에 관한 설명은 도움말을 그대로 옮깁니다...
참고하세요...

Assign the Parent property.

Setting the Parent property is always the first thing to do after
constructing a control. The parent is the component that
contains the control visually; usually it is the form on which
the control appears, but it might be a group box or panel.
Normally, you'll set Parent to Self, that is, the form.
Always set Parent before setting other properties of the control.





                  THEXDER


+ -

관련 글 리스트
1033 [답변] JEDOSON/콘트롤을 폼상에서 실행시 동적으로 생 longdr 1896 1998/02/01
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.