Q&A

  • 동적생성에 관한 질문입니다.
안녕하세요?



꾸뻑~ 도움의 손길을 뻗어 주세요... ㅠ_ㅠ



QuickReport 에서 QRLabel을 동적생성해서 뿌려 주려고 하는데 안됩니다.



Access Violation 에러가 납니다.



아래 소스에서



①QLabel := TQRLabel.create(Self);

②parent := Self;



로 할 경우는 레포트는 나타나지만 QRLabel 컴포넌트는 나타나지 않습니다.



고수님... 가르침을 부탁드립니다.







<< Source >>



var

Form1: TForm1;

QLabel : TQRLabel;



:

:



procedure TForm1.Query1AfterScroll(DataSet: TDataSet);

var

QR_number : Tcomponent;

begin

QR_number := FindComponent('QRL_No' + inttostr(LineNo));



QLabel := TQRLabel(DetailBand1.FindComponent('QP_' + inttostr(LineNo)));

if not Assigned(QLabel) then

begin

QLabel := TQRLabel.create(DetailBand1); //①

with QLabel do

begin

enabled := false;

name := 'QP_'+ inttostr(LineNo);

parent := DetailBand1; //②

left := 15;

top := TQRLabel(QR_number).Top ;

width := 140;

height := LineNo * 15;

caption := Sentence;

autosize := false;

wordwrap := true;

enabled := true;

end;

end;

end;







0  COMMENTS