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
[1823] [질문] 리소스에서 그림 불러오기../프포
wkdwngh [ ] 3490 읽음    1999-08-21 09:42
제가 빌더에서 PaintBox에 리소스 비트맵 그림 파일 그리려고 하거든요...

근데.. 안 나와요.. 책 보고 했는데... 소스는 다음과 같습니다....

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "tetris.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
tet1 = new Graphics::TBitmap();
tet2 = new Graphics::TBitmap();
tet3 = new Graphics::TBitmap();
back = new Graphics::TBitmap();


tet1->LoadFromResourceName((int)HInstance,"TET1");
tet2->LoadFromResourceName((int)HInstance,"TET2");
tet3->LoadFromResourceName((int)HInstance,"TET3");
back->LoadFromResourceName((int)HInstance,"BACK");
PaintBox1->Canvas->Draw(0,0,back);

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete tet1;
delete tet2;
delete tet3;
delete back;


}
//---------------------------------------------------------------------------

그리구 헤더 파일에서는요...


//---------------------------------------------------------------------------
#ifndef tetrisH
#define tetrisH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
        TPaintBox *PaintBox1;
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall FormDestroy(TObject *Sender);

private:
  Graphics::TBitmap* tet1, * tet2, * tet3, * back;

          // User declarations
public:         // User declarations
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

이렇게 됩니다. 물론, 프로젝트 관리자에 리소스 파일을 추가시켰습니다.

그래서 실행시켜보면 폼만 덜렁 나타나요... 어떻하죠??

.


+ -

관련 글 리스트
1823 [질문] 리소스에서 그림 불러오기../프포 wkdwngh 3490 1999/08/21
1841     [답변] WKDWNGH/ 리소스에서 그림 불러오기../프포 박지훈.임프 3512 1999/08/23
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.