业务模型\协同系统\面板功能\工作台\工作台
procedure TMAINFORM.InitPanels;
var
I: Integer;
begin
SetLength(FPanels, 3);
for I := Low(FPanels) to High(FPanels) do
SetLength(FPanels[I], 1);
FPanels[0][0] := pnlLeft1;
FPanels[1][0] := pnlRight1;
FPanels[2][0] := pnlLeft2;
//FPanels[3][0] := pnlRight2;
end;
控件pnlRight2设置属性为不可见
问题3,你需要看看这个代码
procedure TMAINFORM.pnlClientResize(Sender: TObject);
const
cSpaceWidth = 8;
var
I, J: Integer;
lWidth: Integer;
lHeight: Integer;
lColCount, lRowCount, lRowOffs, lColOffs: Integer;
begin
lRowCount := High(FPanels) - Low(FPanels) + 1;
lColCount := High(FPanels[0]) - Low(FPanels[0]) + 1;
lWidth := pnlClient.Width div lColCount;
lHeight := pnlClient.Height div lRowCount;
for I := Low(FPanels) to High(FPanels) do
begin
if I > 0 then
lRowOffs := cSpaceWidth div 2
else
lRowOffs := 0;
// TODO: 需要考虑一行中列没有值的情况,列没值时融合可能会比较好
for J := Low(FPanels[I]) to High(FPanels[I]) do
begin
if J > 0 then
lColOffs := cSpaceWidth div 2
else
lColOffs := 0;
FPanels[I][J].BoundsRect := Classes.Bounds(
lWidth * J + cSpaceWidth - lColOffs,
lHeight * I + cSpaceWidth - lRowOffs,
lWidth - (cSpaceWidth + cSpaceWidth div 2),
lHeight - (cSpaceWidth + cSpaceWidth div 2));
end;
end;
end; |