델파이의 Create 프로시저는 메모리 생성/초기화/객체 할당의 기능을 합니다.
C++빌더에서는 포인터로 선언하셔서 new로 할당하셔야 합니다.
예)
TStringList *sl = new TStringList;
또한 객체.Free; 메소드는 delete 객체; 로 대체됩니다.
-locke
DreamTree 님이 쓰신 글 :
: 아래 소스는 GraphicEx를 이용하여 각종 포맷의 이미지를 표시하는 Delphi용 코드입니다.
: 이를 Cbuilder용 코드로 변환하려고 합니다.
: Graphic과 GraphicClass간의 연결을 어떻게 하는지 도저히 모르겟네요...
: Delphi-> Graphic := GraphicClass.Create;
: Cbuilder-> ????
: 도와주세요...
:
: uses
: GraphicEx
:
: ...
:
:
: procedure TForm1.DoLoad(const FileName: String);
: var
: : TGraphicExGraphicClass;
: Graphic: TGraphic;
: begin
: Screen.Cursor := crHourGlass;
: try
: try
: GraphicClass := FileFormatList.GraphicFromContent(FileName);
: if GraphicClass = nil then
: Image1.Picture.LoadFromFile(FileName)
: else
: begin
: Graphic := GraphicClass.Create;
: Graphic.LoadFromFile(FileName);
: Image1.Picture.Graphic := Graphic;
: end;
: except
: end;
: finally
: Screen.Cursor := crDefault;
: end;
: end; |