delphi – 在TLageControl上的TLinkLabel背景
发布时间:2020-12-15 03:33:34 所属栏目:大数据 来源:网络整理
导读:我试图在TPageControl上使用TLinkLabel,我找不到一种方法来使其成为父级的背景. // Image removed because the website doesn't exist any more // and I can't find it anywhere... Sorry. 您可以看到,父标签页的可爱渐变不会保留在链接文本后面. 我希望在
我试图在TPageControl上使用TLinkLabel,我找不到一种方法来使其成为父级的背景.
// Image removed because the website doesn't exist any more // and I can't find it anywhere... Sorry. 您可以看到,父标签页的可爱渐变不会保留在链接文本后面. 我希望在流动的文本块(TLinkLabel提供的功能)中拥有多个链接的功能,并将父文本的背景显示在文本后面. TLinkLabel没有ParentBackground属性.我已经尝试创建一个派生类,将csParentBackground添加到控件样式,无效: TMyLinkLabel = class (TLinkLabel) public constructor Create(AOwner: TComponent); override; end; ... constructor TMyLinkLabel.Create(AOwner: TComponent); begin inherited; ControlStyle := ControlStyle - [csOpaque] + [csParentBackground] end; 任何人都有什么想法? 解决方法
Nat,你几乎在那里,你对TLinkLabel的ControlStyle的更改.另外要做的还是要确保标准的Windows静态控件的父级(就是TLinkLabel是)正确处理WM_CTLCOLORSTATIC消息.
VCL有一个很好的重定向机制,让控件处理作为通知发送到其父窗口的消息.使用这个完全独立的透明链接标签可以创建: type TTransparentLinkLabel = class(TLinkLabel) private procedure CNCtlColorStatic(var AMsg: TWMCtlColorStatic); message CN_CTLCOLORSTATIC; public constructor Create(AOwner: TComponent); override; end; constructor TTransparentLinkLabel.Create(AOwner: TComponent); begin inherited; ControlStyle := ControlStyle - [csOpaque] + [csParentBackground]; end; procedure TTransparentLinkLabel.CNCtlColorStatic(var AMsg: TWMCtlColorStatic); begin SetBkMode(AMsg.ChildDC,TRANSPARENT); AMsg.Result := GetStockObject(NULL_BRUSH); end; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |