设计器

优化
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

View File

@ -645,6 +645,12 @@ type TVclDesigner = class(tvcform)
par := FCurrentNode.Component.Cwnd; par := FCurrentNode.Component.Cwnd;
r := FComponentCreater.ComponentCreater(FCurrentNode,FCurrentNode.Component.Cwnd); r := FComponentCreater.ComponentCreater(FCurrentNode,FCurrentNode.Component.Cwnd);
if not r then exit; if not r then exit;
npar := par;
while not(npar.WsPopUp) do
begin
npar := par.parent;
end
FProjectManager.hiddeneditor(npar.BoundsRect);//此处隐藏编辑器
r.CreateName(); r.CreateName();
FVariableSelecter.additem(r); FVariableSelecter.additem(r);
BindCwndMessage(r.Cwnd); BindCwndMessage(r.Cwnd);
@ -830,19 +836,21 @@ type TVclDesigner = class(tvcform)
if FComponentCreater is class(TDRootComponent) then if FComponentCreater is class(TDRootComponent) then
begin begin
FCurrentNode := (tr.RootItem.items)[0]; FCurrentNode := (tr.RootItem.items)[0];
if not FCurrentNode then exit; if not FCurrentNode then return FComponentCreater := nil;
O1 := FCurrentNode.Component.Cwnd; O1 := FCurrentNode.Component.Cwnd;
if not o1 then exit; if not o1 then return FComponentCreater := nil;
end else o1 := o; end else o1 := o;
xy := array(0,0); xy := array(0,0);
_wapi.GetCursorPos(xy); _wapi.GetCursorPos(xy);
FCurrentClikPos := o.ScreenToClient(xy[0],xy[1]); FCurrentClikPos := o.ScreenToClient(xy[0],xy[1]);
//FCurrentClikPos := array(e.lolparam,e.hilparam);//o1.screentoclient(e.lolparam,e.hilparam); //FCurrentClikPos := array(e.lolparam,e.hilparam);//o1.screentoclient(e.lolparam,e.hilparam);
r := CreateComponent(); r := CreateComponent();
FComponentCreater := nil;
if not r then return MessageBoxA("控件放置位置不兼容!","提示",0,self); if not r then return MessageBoxA("控件放置位置不兼容!","提示",0,self);
o1 := r.Cwnd; o1 := r.Cwnd;
o1.setpublish("left",o1.left,nil); o1.setpublish("left",o1.left,nil);
o1.setpublish("top",o1.top,nil); o1.setpublish("top",o1.top,nil);
end end
return ; return ;
end end

View File

@ -699,6 +699,17 @@ type TProjectView = class(TVCForm) //
FTslEditer.Show(SW_SHOWNOACTIVATE); // FTslEditer.Show(SW_SHOWNOACTIVATE); //
_wapi.bringWindowToTop(FTslEditer.Handle); _wapi.bringWindowToTop(FTslEditer.Handle);
end end
function hiddeneditor(rc);
begin
if FTslEditer.visible then
begin
if ifarray(rc) then
begin
if not(intersectrect(rc,FTslEditer.BoundsRect)) then return;
end
FTslEditer.visible := false;
end
end
function ShowCurrentFormCode(); function ShowCurrentFormCode();
begin begin
if FCurrentOpend then r := FCurrentOpend.gettsfname(); if FCurrentOpend then r := FCurrentOpend.gettsfname();

View File

@ -295,6 +295,13 @@ type TWinControl = class(tcontrol)
UpdateControlState(); UpdateControlState();
end end
protected protected
function SetParentFont(v:bool);override;
begin
if inherited then
begin
InvalidateRect(nil,false);
end
end
function SetImageList(v); function SetImageList(v);
begin begin
if FImageList=v then exit; if FImageList=v then exit;

View File

@ -330,7 +330,8 @@ type tcustombtn = class(TCustomControl) //
function Create(aowner); function Create(aowner);
begin begin
inherited; inherited;
fbtntimer := new TCustomTimer(self);
fbtntimer.Ontimer := thisfunction(judgestate);
end end
function AfterConstruction();override; function AfterConstruction();override;
begin begin
@ -382,6 +383,10 @@ type tcustombtn = class(TCustomControl) //
begin begin
Fbtnstate := true; Fbtnstate := true;
InvalidateRect(nil,false); InvalidateRect(nil,false);
{$ifdef linux}
{$else}
fbtntimer.start();
{$endif}
end end
inherited; inherited;
end end
@ -392,6 +397,10 @@ type tcustombtn = class(TCustomControl) //
if Fbtnstate then if Fbtnstate then
begin begin
Fbtnstate := 0; Fbtnstate := 0;
{$ifdef linux}
{$else}
fbtntimer.stop();
{$endif}
InvalidateRect(nil,false); InvalidateRect(nil,false);
end end
end end
@ -548,7 +557,7 @@ type tcustombtn = class(TCustomControl) //
paintfocus(dc,r); paintfocus(dc,r);
dc.pen.style := PS_DOT; dc.pen.style := PS_DOT;
dc.pen.color := 16440490;//rgb(170,220,250); dc.pen.color := 16440490;//rgb(170,220,250);
drawrc(dc,r,4); //drawrc(dc,r,4);
dc.pen.style := bps; dc.pen.style := bps;
end end
private private
@ -593,7 +602,20 @@ type tcustombtn = class(TCustomControl) //
FtextPosition:=n; FtextPosition:=n;
InvalidateRect(nil,false); InvalidateRect(nil,false);
end 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 private
fbtntimer;
FBtnfocused; FBtnfocused;
FdoingClick; FdoingClick;
FpushLike; FpushLike;