这样写为什么不行?
unit SheerTreeView;interfaceuses
SysUtils, Classes, Controls, ComCtrls, Themes;type
TSheerTreeView = class(TTreeView)
private
{ Private declarations }
FTransparentSet: Boolean;
protected
{ Protected declarations }
function GetTransparent: Boolean;
procedure SetTransparent(Value: Boolean);
published
{ Published declarations }
constructor Create(AOwner: TComponent); override;
property Transparent: Boolean read GetTransparent write SetTransparent stored FTransparentSet;
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('AMIAO', [TSheerTreeView]);
end;constructor TSheerTreeView.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle + [csReplicatable];
Width := 65;
Height := 17;
if ThemeServices.ThemesEnabled then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque];
end;procedure TSheerTreeView.SetTransparent(Value: Boolean);
begin
if Transparent <> Value then
begin
if Value then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque];
Invalidate;
end;
FTransparentSet := True;
end;function TSheerTreeView.GetTransparent: Boolean;
begin
Result := not (csOpaque in ControlStyle);
end;
end.
unit SheerTreeView;interfaceuses
SysUtils, Classes, Controls, ComCtrls, Themes;type
TSheerTreeView = class(TTreeView)
private
{ Private declarations }
FTransparentSet: Boolean;
protected
{ Protected declarations }
function GetTransparent: Boolean;
procedure SetTransparent(Value: Boolean);
published
{ Published declarations }
constructor Create(AOwner: TComponent); override;
property Transparent: Boolean read GetTransparent write SetTransparent stored FTransparentSet;
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('AMIAO', [TSheerTreeView]);
end;constructor TSheerTreeView.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle + [csReplicatable];
Width := 65;
Height := 17;
if ThemeServices.ThemesEnabled then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque];
end;procedure TSheerTreeView.SetTransparent(Value: Boolean);
begin
if Transparent <> Value then
begin
if Value then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque];
Invalidate;
end;
FTransparentSet := True;
end;function TSheerTreeView.GetTransparent: Boolean;
begin
Result := not (csOpaque in ControlStyle);
end;
end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货