Лабораторная работа №1 по Delphi
Лабораторная работа №1.
Цель работы: Изучение методов
визуального программирования в Delphi.
Текст программы:
unit Unit1;
interface
uses
Windows,
Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,
ExtCtrls, Buttons;
type
TForm1 =
class(TForm)
ScrollBar1:
TScrollBar;
ScrollBar2:
TScrollBar;
Shape1:
TShape;
ColorDialog1:
TColorDialog;
Panel1:
TPanel;
Button1:
TButton;
Button2:
TButton;
ComboBox1:
TComboBox;
BitBtn1:
TBitBtn;
procedure
Button2Click(Sender: TObject);
procedure
ComboBox1Change(Sender: TObject);
procedure
ScrollBar1Change(Sender: TObject);
procedure
ScrollBar2Change(Sender: TObject);
procedure
BitBtn1Click(Sender: TObject);
private
{ Private
declarations }
public
{ Public
declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure
TForm1.Button2Click(Sender: TObject);
begin
if
ColorDialog1.Execute then
Form1.Color:=ColorDialog1.Color;
end;
procedure
TForm1.Button1Click(Sender: TObject);
if
colorDialog1.Execute then
Shape1.Brush.Color:=ColorDialog1.Color;
end;
procedure
TForm1.ComboBox1Change(Sender: TObject);
begin
Shape1.Shape:=TShapeType(ComboBox1.ItemIndex);
end;
procedure
TForm1.ScrollBar1Change(Sender: TObject);
begin
Shape1.Width:=ScrollBar1.Position*3;
end;
procedure
TForm1.ScrollBar2Change(Sender: TObject);
begin
Shape1.Height:=Scrollbar2.Position*2;
end;
procedure
TForm1.BitBtn1Click(Sender: TObject);
begin
Close;
end;
end.