1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| procedure TForm1.rdgOrientationClick(Sender: TObject);
procedure FondBlanc;
begin
pnl4img.Canvas.Pen.Color := clWhite;
pnl4img.Canvas.Brush.Color := clWhite;
pnl4img.Canvas.Rectangle(0,0,pnl4img.ClientWidth,pnl4img.ClientHeight);
end;
begin
// effacer l'image précédente, if any
FondBlanc; // mandatory sinon les images s'empilent
case rdgOrientation.ItemIndex of
0: imgSRC := TBGRABitmap.Create('image.png'); // horizontale
1: imgSRC := TBGRABitmap.Create('Penguins-384x384.png'); // carrée
2: imgSRC := TBGRABitmap.Create('Penguins-256x384.png'); // verticale
3: begin imgSRC.EraseRect(0,0,pnl4img.Width,pnl4img.Height,255); // fond blanc
SomeText0 := ''; stb.Panels[0].Text := SomeText0; // texte d'info dans le StatusBar
exit; // pour éviter le pnl4imgPaint
end;
end;
pnl4imgPaint(nil); // obligatoire, sinon aucun changement d'image n'est pris en compte
end; |