Предмет: Информатика, автор: sula0

Delphi Создайте приложение, на форму которого помещены компоненты: Button и OpenDialog. Напишите обработчик события OnClick компонента Button, который открывает диалог OpenDialog и, в случае положительного ответа, загружает в память компьютера выбран-ный пользователем графический файл BMP и отображает его в центре формы.


nemolkl: На форме разрешается добавить TImage или только Button и OpenDialog?
sula0: разрешается
sula0: главное - как разместить по центру
sula0: остальное вроде сделал
sula0: помоги, пожалуйста

Ответы

Автор ответа: nemolkl
1
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

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;

end.


sula0: спасибо, братан, от души душевно в душу
Похожие вопросы
Предмет: Английский язык, автор: Брoдягa
Решите тест. Даю max баллов за правильное решение.

1. В каком из следующих слов звук, передаваемый "u" отличается от остальных:
а) put b) full c) pull d) sun

2. Выберите форму множественного числа существительных "a boy":
а) boies b) boys c) boyes

3. Вставьте артикль a, an, the:
My friend has ... car.

4. Нет задания. Пропуск.

5. Выберете соответствующую форму оборота there is, there are:
The ... a telegram on the table.

6. Укажите слово, которое не имеет отношения к остальным:
an uncle, pfrents, a niece, a housewife, a cousin

7. Дополните следующее предложение:
My sister's son is my ...

8. Прочитайте текст и выполните задания к нему:
This is a story about an old man and an old woman. They lived near the fine green woods. One summer day the old man went to the woods to pick mushrooms. It was a hot day and the old man soon got tired and thirsty, but there was no water in the woods. So he sat down under the tree to rest.
Everything around him was so fresh and fine, but he was so old and sad. He wanted to return the days when he was young and fine. Suddenly he saw a little spring near him. He began to drink the water. Soon he felt that he became younger and in a few minutes he was a fine young man again.
He ran home to tell his wife about the spring. When his wife heard the story, she ran to the woods quickly, though she was very old.
It was late, but the old woman didn't return home. So the man went to the woods to meet her. When he came up to the spring, he saw a little girl. It was his wife. The man thought, "My wife wanted to become young so much that she drank too much water".

Дополните предложение: This text is about...
a) a husband and a wife
b) a brother and a sister
c) a girl and her boy-friend

9. Where did an old man and old woman live?
a) not far from the beautiful lake
b) near the fine green woods
c) in the wonderful mountains

10. What did the old man feel in a hot day?
a) he was hungry
b) he was thirsty
c) he was angry

11. What did he dream about under the tree?
a) he wanted to die
b) he wanted to be rich
c) he wanted to return the days when he was young

12. What did he drink water from?
a) from the spring
b) from the river
c) from the lake

13. What happened to him after drinking the water?
a) he became a woman
b) he became a young man
c) he became a goat

14. Who did the man find in the woods?
a) a little girl
b) an old witch
c) a baby

15. Why did the old woman drink too much water?
a) She wanted to drink very much
b) She wanted to swim
c) She wanted to become young very much

16. расположите части текста в правильной последовательности:
a) Everything around him was so fresh and fine, but he was so old and sad. He wanted to return the days when he was young and fine. Suddenly he saw a little spring near him. He began to drink the water. Soon he felt that he became younger and in a few minutes he was a fine young man again.
b) He ran home to tell his wife about the spring. When his wife heard the story, she ran to the woods quickly, though she was very old.
c) This is a story about an old man and an old woman. They lived near the fine green woods. One summer day the old man went to the woods to pick mushrooms. It was a hot day and the old man soon got tired and thirsty.

17. Вставьте нужное слово:
My parents ... workers.

18. Подберите пары противоположные по значению:
Young, ugly, slow, beautiful, dirty, old, fast, tidy

19. Вставьте few, little, a few, a little:
Give me ... water, please.

20. Употребите does или do в предложение:
... he drive a car well?

21. Заполните пропуски недостающими буквами:
Pen_ioner, conveni_nces

22. Найдите слову соответствующий перевод:
intelligent
1) интеллигентный 2) интеллектуальный 3) умный

23. Составьте предложения из данных слов:
room, Ann, a, has, got

24. Вставьте нужный предлог:
I go ... the college every day.

25. Образуйте отрицательную форму в предложение:
I write letters to my friends every month.
Предмет: Алгебра, автор: Radikulite