设计器

优化
This commit is contained in:
JianjunLiu
2022-12-14 11:08:04 +08:00
parent 532b2959b5
commit 1a1052169d
4 changed files with 52 additions and 4 deletions
+7
View File
@@ -295,6 +295,13 @@ type TWinControl = class(tcontrol)
UpdateControlState();
end
protected
function SetParentFont(v:bool);override;
begin
if inherited then
begin
InvalidateRect(nil,false);
end
end
function SetImageList(v);
begin
if FImageList=v then exit;
+24 -2
View File
@@ -330,7 +330,8 @@ type tcustombtn = class(TCustomControl) //
function Create(aowner);
begin
inherited;
fbtntimer := new TCustomTimer(self);
fbtntimer.Ontimer := thisfunction(judgestate);
end
function AfterConstruction();override;
begin
@@ -382,6 +383,10 @@ type tcustombtn = class(TCustomControl) //
begin
Fbtnstate := true;
InvalidateRect(nil,false);
{$ifdef linux}
{$else}
fbtntimer.start();
{$endif}
end
inherited;
end
@@ -392,6 +397,10 @@ type tcustombtn = class(TCustomControl) //
if Fbtnstate then
begin
Fbtnstate := 0;
{$ifdef linux}
{$else}
fbtntimer.stop();
{$endif}
InvalidateRect(nil,false);
end
end
@@ -548,7 +557,7 @@ type tcustombtn = class(TCustomControl) //
paintfocus(dc,r);
dc.pen.style := PS_DOT;
dc.pen.color := 16440490;//rgb(170,220,250);
drawrc(dc,r,4);
//drawrc(dc,r,4);
dc.pen.style := bps;
end
private
@@ -593,7 +602,20 @@ type tcustombtn = class(TCustomControl) //
FtextPosition:=n;
InvalidateRect(nil,false);
end
function judgestate(o,e);
begin
xy := array(0,0);
_wapi.getcursorPos(xy);
nxy := ScreenToClient(xy[0],xy[1]);
if nxy[0]<0 or nxy[0]>Width or nxy[1]<0 or nxy[1]>Height then
begin
Fbtnstate := 0;
InvalidateRect(nil,false);
o.stop();
end
end
private
fbtntimer;
FBtnfocused;
FdoingClick;
FpushLike;