继承TDBLookupComboboxEh 添加了label
constructor TTestComboboxEh.Create(AOwner: TComponent);
begin
inherited;
FLabel := TLabel.Create(self);
FLabel.Parent :=TTestComboboxEh(AOwner);
FLabel.Visible:=True;
UpdateLabel(self);
end;procedure TTestComboboxEh.UpdateLabel(AOwner: TComponent);
begin
FLabel.top := TTestComboboxEh(AOwner).top + ((TTestComboboxEh(AOwner).height - FLabel.height) div 2);
FLabel.left := TTestComboboxEh(AOwner).left-FLabel.canvas.textwidth(FLabel.caption)-FLabelMargin;
end;procedure TTestComboboxEh.WMSize(var Msg: TMessage);
begin
inherited;
UpdateLabel(self);
end;为什么在Form控件显示正常,在panel,pagecontrol上面 控件的label就显示错乱了,变成Form的坐标 而不是panel的怎样修改呢?
constructor TTestComboboxEh.Create(AOwner: TComponent);
begin
inherited;
FLabel := TLabel.Create(self);
FLabel.Parent :=TTestComboboxEh(AOwner);
FLabel.Visible:=True;
UpdateLabel(self);
end;procedure TTestComboboxEh.UpdateLabel(AOwner: TComponent);
begin
FLabel.top := TTestComboboxEh(AOwner).top + ((TTestComboboxEh(AOwner).height - FLabel.height) div 2);
FLabel.left := TTestComboboxEh(AOwner).left-FLabel.canvas.textwidth(FLabel.caption)-FLabelMargin;
end;procedure TTestComboboxEh.WMSize(var Msg: TMessage);
begin
inherited;
UpdateLabel(self);
end;为什么在Form控件显示正常,在panel,pagecontrol上面 控件的label就显示错乱了,变成Form的坐标 而不是panel的怎样修改呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货