我正在使用此代码从表单的非客户区中删除 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 样式?