Update utslvclpage.tsf

优化标签
This commit is contained in:
tslediter 2024-02-06 15:58:36 +08:00
parent b99970fa64
commit b57770b81a
1 changed files with 28 additions and 19 deletions

View File

@ -109,7 +109,7 @@ type tcustompagecontrol = class(TCustomControl)
if not fownerdraw then
begin
fh := ft.height;
FTabHeight := fh+7;
FTabHeight := fh+8;
end
FTabItemswidth := array();
e := new tuieventbase(0,0,0,0);
@ -126,14 +126,15 @@ type tcustompagecontrol = class(TCustomControl)
end
end
FMaxsize := 0;
if FTabPosition in array(alLeft,alRight) then
{if FTabPosition in array(alLeft,alRight) then
begin
FTabItemswidth := zeros(length(FTabItemswidth))+maxvalue(FTabItemswidth);
FMaxsize := length(FTabItemswidth)*FTabHeight;
end else
begin
FMaxsize := sum(FTabItemswidth);
end
end }
FMaxsize := sum(FTabItemswidth);
FClientarea := rec;
FScrollBtnRect := 0;
Fprevrect := 0;
@ -144,12 +145,12 @@ type tcustompagecontrol = class(TCustomControl)
begin
if FTabItemswidth then
begin
FClientarea[0] :=rec[0]+FTabItemswidth[0];
FClientarea[0] :=rec[0]+FTabHeight;//FTabItemswidth[0];
if length(FTabItemswidth)>1 and (FMaxsize>(rec[3]-rec[1])) then
begin
FScrollBtnRect := array(rec[0],rec[3]-FTabHeight*2,rec[0]+FTabItemswidth[0],rec[3]);
Fprevrect := array(rec[0],rec[3]-FTabHeight*2,rec[0]+FTabItemswidth[0],rec[3]-FTabHeight);
Fnextrect := array(rec[0],rec[3]-FTabHeight,rec[0]+FTabItemswidth[0],rec[3]);
FScrollBtnRect := array(rec[0],rec[3]-FTabHeight*2,rec[0]+FTabHeight,rec[3]);
Fprevrect := array(rec[0],rec[3]-FTabHeight*2,rec[0]+FTabHeight,rec[3]-FTabHeight);
Fnextrect := array(rec[0],rec[3]-FTabHeight,rec[0]+FTabHeight,rec[3]);
end else
begin
FirstViewIndex := 0;
@ -159,8 +160,8 @@ type tcustompagecontrol = class(TCustomControl)
begin
if i>=FirstViewIndex then
begin
FTabRects[i] := array(0,ybase,FTabItemswidth[0],ybase+FTabHeight);
ybase+=FTabHeight;
FTabRects[i] := array(0,ybase,FTabHeight,ybase+FTabItemswidth[i]-1);
ybase+=FTabItemswidth[i];
if xbase>(rec[3]-FTabHeight-FTabHeight) then break;
end
else FTabRects[i] := nil;
@ -171,12 +172,12 @@ type tcustompagecontrol = class(TCustomControl)
begin
if FTabItemswidth then
begin
FClientarea[2] :=rec[2]-FTabItemswidth[0];
FClientarea[2] :=rec[2]-FTabHeight;
if length(FTabItemswidth)>1 and (FMaxsize>(rec[3]-rec[1])) then
begin
FScrollBtnRect := array(rec[2]-FTabItemswidth[0],rec[3]-FTabHeight*2,rec[2],rec[3]);
Fprevrect := array(rec[2]-FTabItemswidth[0],rec[3]-FTabHeight*2,rec[2],rec[3]-FTabHeight);
Fnextrect := array(rec[2]-FTabItemswidth[0],rec[3]-FTabHeight,rec[2],rec[3]);
FScrollBtnRect := array(rec[2]-FTabHeight,rec[3]-FTabHeight*2,rec[2],rec[3]);
Fprevrect := array(rec[2]-FTabHeight,rec[3]-FTabHeight*2,rec[2],rec[3]-FTabHeight);
Fnextrect := array(rec[2]-FTabHeight,rec[3]-FTabHeight,rec[2],rec[3]);
end else
FirstViewIndex := 0;
ybase := 0;
@ -184,8 +185,8 @@ type tcustompagecontrol = class(TCustomControl)
begin
if i>=FirstViewIndex then
begin
FTabRects[i] := array(rec[2]-FTabItemswidth[0],ybase,rec[2],ybase+FTabHeight);
ybase+=FTabHeight;
FTabRects[i] := array(rec[2]-FTabHeight,ybase,rec[2],ybase+FTabItemswidth[i]-1);
ybase+=FTabItemswidth[i];
if xbase>(rec[3]-FTabHeight-FTabHeight) then break;
end
else FTabRects[i] := nil;
@ -215,7 +216,7 @@ type tcustompagecontrol = class(TCustomControl)
begin
if i>=FirstViewIndex then
begin
FTabRects[i] := array(xbase,0,xbase+FTabItemswidth[i],FTabHeight);
FTabRects[i] := array(xbase,0,xbase+FTabItemswidth[i]-1,FTabHeight);
xbase+=FTabItemswidth[i];
if xbase>(rec[2]-FTabHeight-FTabHeight) then break;
end else
@ -239,7 +240,7 @@ type tcustompagecontrol = class(TCustomControl)
begin
if i>=FirstViewIndex then
begin
FTabRects[i] := array(xbase,rec[3]-FTabHeight,xbase+FTabItemswidth[i],rec[3]);
FTabRects[i] := array(xbase,rec[3]-FTabHeight,xbase+FTabItemswidth[i]-1,rec[3]);
xbase+=FTabItemswidth[i];
if xbase>(rec[2]-FTabHeight-FTabHeight) then break;
end else
@ -326,12 +327,20 @@ type tcustompagecontrol = class(TCustomControl)
dc.pen.color := 13158600;//rgb(200,200,200);
if FCurrentid=i then
begin
dc.brush.color := 0xf0f0f0;//rgb(100,192,250);//rgb(230,240,250);//rgb(200,200,200);
dc.brush.color := 0xc0b0a0;//rgb(100,192,250);//rgb(230,240,250);//rgb(200,200,200);
end else dc.brush.color := 16711422;//rgb(254,254,254);
dc.draw("roundrect",array(rec[0:1],rec[2:3],array(2,2)));
rec[1]+=2;
it := FTabItems[i];
dc.drawtext(it.caption,rec,DT_CENTER .|DT_VCENTER);
if fTabPosition in array(alLeft,alRight) then
begin
dc.SaveDC();
dc.trans(pi()/2,rec[0],rec[3]);
dc.textout(it.Caption,array(4,3));
//dc.drawtext(it.caption,array(0,0,rec[3]-rec[1],rec[2]-rec[0]),DT_CENTER .|DT_VCENTER);
dc.RestoreDC();
end else
dc.drawtext(it.caption,rec,DT_CENTER .|DT_VCENTER);
end
end
end