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

C++빌더 Q&A
C++Builder Programming Q&A
[69577] 쓰레드로 프로그레스바 생성할 수 있는가?
악두이 [] 1899 읽음    2013-05-31 09:34
안녕하세요
큰 파일을 읽어올때 파일을 읽어오는 중이라는 것을 보여주기 위해 프로그래스바를 만들어 보여주려고 합니다.
그러기위해 쓰레드를 사용할 예정인데 쓰레드 내에서 프로그래스바를 생성하면 폼에 그려지지 않아 어떤점이 잘 못 되었는지
확인을 부탁드리기 위해 문의 드립니다.

소스
쓰레드를 생성시키는 폼 부분
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    Form2->Show();
    ProgressBar* t = new ProgressBar(true, Form1);
    TButton* tt = new TButton(this);
    tt->Parent =Form2;
    tt->Show();
}
//---------------------------------------------------------------------------

쓰레드 부분
__fastcall ProgressBar::ProgressBar(bool CreateSuspended)
    : TThread(CreateSuspended)
{
}
__fastcall ProgressBar::ProgressBar(bool CreateSuspended, TComponent* parent)
    : TThread(CreateSuspended)
{
    TComponent* FParent = parent; //프로그래스를 그릴 폼을 받아오는 부분
}
//---------------------------------------------------------------------------
void __fastcall ProgressBar::Execute()
{
    Synchronize(&Progressing);
}
//---------------------------------------------------------------------------
void __fastcall ProgressBar::Progressing()
{
    Bar = new TcxProgressBar(FParent); //프로그래스 생성
    Bar->Parent = (TWinControl*)FParent; //프로그래스바의 부모 지정
    Bar->Show(); //프로그래스바 보이기
}

+ -

관련 글 리스트
69577 쓰레드로 프로그레스바 생성할 수 있는가? 악두이 1899 2013/05/31
69582     Re:쓰레드로 프로그레스바 생성할 수 있는가? 장성호 2067 2013/05/31
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.