mischmasch
Programmer
- May 10, 2011
- 11
Hi,
I have problem with dynamic creation of TImage on TTabSheet. To make it, I use code below but it doesn't work - I don't see any Image on TabSheet. I don't know what I do wrong. Anybody knows?
-------------
On Form, I have PageControl where I want to create some number of TabSheet, for example 4 sheets, so my code looks like below:
I have problem with dynamic creation of TImage on TTabSheet. To make it, I use code below but it doesn't work - I don't see any Image on TabSheet. I don't know what I do wrong. Anybody knows?
-------------
On Form, I have PageControl where I want to create some number of TabSheet, for example 4 sheets, so my code looks like below:
procedure DoSomething;
var
for i := 0 to 3 do
begin
end;
var
NewTabSheet: TTabSheet;
NewImage: TImage;
i: Integer;
beginNewImage: TImage;
i: Integer;
for i := 0 to 3 do
begin
NewTabSheet := TTabSheet.Create(Form.PageControl);
NewTabSheet.PageControl := Form.PageControl;
NewTabSheet.Name := 'MySheet' + IntToStr(i);
NewTabSheet.Caption := IntToStr(i);
NewImage := TImage.Create(NewTabSheet);
NewImage.Parent := NewTabSheet;
NewImage.Name := 'imgMyPicture' + IntToStr(i);
NewImage.Align := alClient;
NewImage.Canvas.Font.Color := clGray;
NewImage.Canvas.TextOut(10, 10, 'Page: ' + IntToStr(i));
end;NewTabSheet.PageControl := Form.PageControl;
NewTabSheet.Name := 'MySheet' + IntToStr(i);
NewTabSheet.Caption := IntToStr(i);
NewImage := TImage.Create(NewTabSheet);
NewImage.Parent := NewTabSheet;
NewImage.Name := 'imgMyPicture' + IntToStr(i);
NewImage.Align := alClient;
NewImage.Canvas.Font.Color := clGray;
NewImage.Canvas.TextOut(10, 10, 'Page: ' + IntToStr(i));