프로그래밍/델파이
델파이에서 ActiveX 콘트롤 만들기(ActiveForm 쓰지 않고)
panpro
2006. 11. 5. 12:48
델파이 7 기준.
메뉴에서
File > New > Other > ActiveX탭 > ActiveX 콘트롤 선택
그럼 ActiveX Control Wizard가 뜨는데, 여기서 기본이 되는 VCL Class Name을 TFrame으로 보통 선택한다. 물론 용도에 따라 다르게 선택하면 되겠지. 나머지는 뭐 다 알아서.
그리고 바로 메뉴에서
File > New > Other > ActiveX탭 > Com Object나 Com Object + Event 등을 선택한다.
Com Object Wizard가 뜨는데, Class Name에 클래스 이름을 넣어준다. 여기서 C나 T로 시작하지 않도록 한다. 이렇게 하고 안에서 컨트롤들을 쓰려면(Fast Report같은) Create 할 때 Owner에 그 안의 FDelphiControl를 사용하면 된다.
예)
procedure TPanFrame2.Init;
begin
frReport1 := TfrReport.Create(FDelphiControl);
try
frReport1.LoadFromFile('D:\panboy\RnD\test\test2.frf');
frReport1.PrepareReport;
//frReport1.ShowReport;
//frReport1.DesignReport;
finally
frReport1.Free;
end;
end;