type TForm1 = class(TForm) Image1: TImage; Button1: TButton; OpenDialog1: TOpenDialog; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); begin if OpenDialog1.Execute then begin Image1.Picture.LoadFromFile(OpenDialog1.FileName); Image1.Stretch:=true; Image1.Left:=form1.Width div 2-image1.Width div 2; Image1.top:=form1.Height div 2-image1.Height div 2; end end;
a = 24
Объяснение:
i=3
a = 12
while i<6:
a = 12 + 3 = 15
i = 3 + 1 = 4
a = 15 + 4 = 19
i = 4 + 1 = 5
a = 19 + 5 = 24
i = 5 + 1 = 6