如何将VCL样式钩子应用于表单的特定组件? [英] How to apply a vcl style hook to a particular component of a form?
问题描述
I'm using the vcl style hook of the answer to this question close button of a tabsheet not supporting vcl styles
and is working fine, but the close button is draw in all the TPageControl components of my app.
我想将此选项(绘制关闭按钮)仅添加到特定表单中.问题是:如何将这个钩子或任何vcl样式的钩子仅应用于特定形式的TPageControl?
And I want add this option (draw the close button) to only a particular form. The question is : how I can apply this hook or any vcl style hook just to the TPageControl of a specific form?
推荐答案
您可以为TPageControl组件使用插入器类
You can use a interposer class for the TPageControl component
检查此示例
type
TPageControl = class(Vcl.ComCtrls.TPageControl);
TForm1 = class(TForm)
PageControl1: TPageControl;
...
...
然后在插入器类所在的同一单元中注册vcl样式钩子
And then register the vcl style hook in the same unit where the interposer class is located
TStyleManager.Engine.RegisterStyleHook(TPageControl, TTabControlStyleHookBtnClose);
或使用完整的限定类型名称
Or using a full qualified type name
TStyleManager.Engine.RegisterStyleHook(Unit1.TPageControl, TTabControlStyleHookBtnClose);
这篇关于如何将VCL样式钩子应用于表单的特定组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!