I am testing the example that came from this Q&A Component Creation - Joining Components Together? to learn how to create a custom/composite component.
While the installed component from the example works dragging on to the form, I can't seem to create it at run time.
procedure TForm1.Button1Click(Sender: TObject);
var
MyPanel2 : TMyPanel;
begin
MyPanel2 := TMyPanel.Create(Form1);
With MyPanel2 do
begin
Left := 10;
Top := 10;
Width := 400;
Height := 400;
Visible := True;
Image.Picture.LoadFromFile('C:\test.png');
end;
end;
I tried both self and Form1 as the owner. Played with properties of both the panel and the image.
Just not sure what I am doing wrong. No errors except when I forgot to add pngimage to my uses. Steps through the code just fine, nothing visually occurs for the run time creation.