【发布时间】:2012-08-15 02:41:09
【问题描述】:
我正在使用此代码从表单的非客户区中删除 vcl 样式。
type
TFormStyleHookNC= class(TMouseTrackControlStyleHook)
protected
procedure PaintBackground(Canvas: TCanvas); override;
constructor Create(AControl: TWinControl); override;
end;
constructor TFormStyleHookNC.Create(AControl: TWinControl);
begin
inherited;
OverrideEraseBkgnd := True;
end;
procedure TFormStyleHookNC.PaintBackground(Canvas: TCanvas);
var
Details: TThemedElementDetails;
R: TRect;
begin
if StyleServices.Available then
begin
Details.Element := teWindow;
Details.Part := 0;
R := Rect(0, 0, Control.ClientWidth, Control.ClientHeight);
StyleServices.DrawElement(Canvas.Handle, Details, R);
end;
end;
initialization
TStyleManager.Engine.RegisterStyleHook(TForm3, TFormStyleHookNC);
在应用此样式钩子之前,表单看起来像
之后
您可以看到菜单消失了,问题是:我该如何解决这个问题?我的意思是如何在不删除 TMainMenu 的情况下从表单的非客户区删除 vcl 样式?
【问题讨论】:
标签: delphi delphi-xe2 vcl-styles