1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| procedure TForm1.FormResize(Sender: TObject);
var
h,i,j,k: integer;
aName: string;
mainPanel: TPanel;
unPanel : TPanel;
unObject: TObject;
begin
h := (Height div cCount)-1;// pour avoir 4 panneaux identiques, et -1 sinon scrollbar verticale
for i := 0 to cCount-1 do begin
//btnmakebmp.Caption := 'test'; ne fonctionne bien qu'avec le dernier bouton, donc pas utilisable
mainPanel := ScrollBox1.Controls[i] as TPanel;
mainPanel.Height := h; // resize des panneaux dans le scrollbox
for j := 0 to mainPanel.ControlCount-1 do begin
unPanel := mainPanel.Controls[j] as TPanel;
//ShowMessage(unPanel.Name); // les 3 sont listés : pnlinfos [on passe dessous] pnlchoix pnl4img
if unPanel.Name = 'pnlinfos' then begin
//ShowMessage(inttostr(unPanel.ControlCount)); // 7, ok
for k := 0 to unPanel.ControlCount-1 do begin
unObject := unPanel.Controls[k] as TControl;
//andnotor if Copy((unObject as TControl).Name, 1, 10) = 'btnmakebmp' then begin
if unObject is TCustomBitBtn then begin
//ShowMessage((unObject as TCustomBitBtn).Name); // btnmakebmp0 btnmakebmp1 btnmakebmp2 btnmakebmp3
//ShowMessage(unObject.Name); // erreur :koi:
with (unObject as TCustomBitBtn) do
if Copy(Name, 1 ,10) = 'btnmakebmp' then // test au cas où plusieurs TBitBtns
SetBounds((Parent.ClientWidth div 2)-10, (Parent.ClientHeight-ButtonHeight) div 2, 80, ButtonHeight); // 20 avec les TBitBtn
end; // if
end; // for k
end; // if pnlinfos
end; // for j
end; // for i
end; |
Partager