由于业务的关系,将餐台面信息放在Panel 上,再将所有的餐台(Panel)放在Form上,
象这样把它写成一个component, 遇到了问题,放在Panel上的Label出不来,和普通的Panel一样关键代码如下:
  TShowPanel = class(TPanel)
  private    TableLabel: TCustomLabel;
    TableText: TCustomLabel;
    FTableText: string;
....
constructor TShowPanel.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Font.Style := [fsUnderline];
  TableLabel := TCustomLabel.Create(self);
  with TableLabel do
  begin
    Parent := Parent;
    Caption := '台号';
    Top := 15;
    Height := 20;
    Visible := true;
  end;  TableText := TCustomLabel.Create(self);
  with TableText do
  begin
    Parent := Parent;
    Caption := '23';
    Top := 15;    Height := 20;
    Visible := true;
  end;end;刚学写控件,向高手请教panel component