有没有人知道如何在运行时将控件,比如TImage,添加到TFlowPanel中?
问候,Pieter
向父控件添加任何控件的方法:
MyControl := TMyControl.Create(MyForm); // Form is the owner
MyControl.Parent := ParentControl; // Parent control is the parent
如果您愿意,您还可以设置其他属性。
与普通容器相比,这种容器的唯一区别就是可以设置子控件的顺序。
OldIndex:= FlowPanel.GetControlIndex( MyControl );
FlowPanel.SetControlIndex( MyControl, OldIndex + 1 );