Приложение а (обязательное)
Листинг программы
unit main;
interface
uses
Windows, SysUtils, Graphics, Controls, Forms, Dialogs, Grids,
Buttons, StdCtrls, ComCtrls, ExtCtrls, Classes;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button1: TButton;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
Shape1: TShape;
Shape2: TShape;
CheckBox1: TCheckBox;
Label6: TLabel;
StatusBar1: TStatusBar;
ColorBox1: TColorBox;
Label7: TLabel;
procedure ListBox1Click(Sender: TObject);
procedure SetProperties(Sender: TObject);
procedure ComponentMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ComponentMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure ComponentMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn5Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure clear_all;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
button: TButton; //1
textBox: TEdit; //2
checkBox: TCheckBox; //3
radio: TRadioButton; //4
panel: TPanel; //5
progress: TProgressBar;// 6
bitBtn: TBitBtn; //7
labelBox: TLabel; //8
labeledEdit: TLabeledEdit; //9
groupBox: TGroupBox; // 10
memoBox: TMemo; //11
speedBtn: TSpeedButton;// 12
shape: TShape; //13
staticText: TStaticText; //14
stringGrid: TStringGrid; //15
Dragg: boolean;
XOffset, YOffset: integer;
FocusRect: TRect;
Selected_Component: TControl;
last:integer;
procedure TForm1.SetProperties(Sender: TObject);
begin
Edit1.Text := IntToStr((Sender as TControl).Left);
Edit2.Text := IntToStr((Sender as TControl).Top);
Edit3.Text := IntToStr((Sender as TControl).Height);
Edit4.Text := IntToStr((Sender as TControl).Width);
case last of
1: ColorBox1.Selected:=button.Font.Color;
2: ColorBox1.Selected:=textBox.Font.Color;
// 3:
// 4:
5: ColorBox1.Selected:=panel.Font.Color;
// 6:
7: ColorBox1.Selected:=bitBtn.Font.Color;
8: ColorBox1.Selected:=labelBox.Font.Color;
9: ColorBox1.Selected:=labeledEdit.Font.Color;
10: ColorBox1.Selected:=groupBox.Font.Color;
11: ColorBox1.Selected:=memoBox.Font.Color;
// 12:
// 13:
// 14:
// 15:
end;
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var x,y:integer; h:textfile; shelp: AnsiString;
begin
x := 200;
y := 200;
if listbox1.Selected[0] then begin //Button
if checkbox1.Checked then begin
AssignFile(h,'h1.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(button)) then begin
button := TButton.Create(Form1);
button.Parent := Form1;
button.Left := x;
button.Top := y;
button.Visible := True;
last:=1;
button.Height := 30;
button.Width := 80;
button.Name := 'Button';
button.OnMouseDown := ComponentMouseDown;
button.OnMouseMove := ComponentMouseMove;
button.OnMouseUp := ComponentMouseUp;
SetProperties(button);
end
else begin button.Destroy; button:=nil; exit; end; end;
if listbox1.Selected[1] then begin //Edit
if checkbox1.Checked then begin
AssignFile(h,'h2.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(textBox)) then begin
textBox := TEdit.Create(Form1);
textBox.Parent := Form1;
textBox.Left := x;
textBox.Top := y;
textBox.Visible := True;
last:=2;
textBox.Height := 30;
textBox.Width := 60;
textBox.Name := 'Edit';
textBox.OnMouseDown := ComponentMouseDown;
textBox.OnMouseMove := ComponentMouseMove;
textBox.OnMouseUp := ComponentMouseUp;
SetProperties(textBox);
end
else begin textBox.Destroy; textBox:=nil; exit; end; end;
if listbox1.Selected[2] then begin //CheckBox
if checkbox1.Checked then begin
AssignFile(h,'h3.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(checkBox)) then begin
checkBox := TCheckBox.Create(Form1);
checkBox.Parent := Form1;
checkBox.Left := x;
checkBox.Top := y;
checkBox.Visible := True;
last:=3;
checkBox.Height := 30;
checkBox.Width := 80;
checkBox.Name := 'CheckBox';
checkBox.OnMouseDown := ComponentMouseDown;
checkBox.OnMouseMove := ComponentMouseMove;
checkBox.OnMouseUp := ComponentMouseUp;
SetProperties(checkBox);
end
else begin checkBox.Destroy; checkBox:=nil; exit; end; end;
if listbox1.Selected[3] then begin //RadioButton
if checkbox1.Checked then begin
AssignFile(h,'h4.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(radio)) then begin
radio := TRadioButton.Create(Form1);
radio.Parent := Form1;
radio.Left := x;
radio.Top := y;
radio.Visible := True;
last:=4;
radio.Height := 30;
radio.Width := 80;
radio.Name := 'RadioButton';
radio.OnMouseDown := ComponentMouseDown;
radio.OnMouseMove := ComponentMouseMove;
radio.OnMouseUp := ComponentMouseUp;
SetProperties(radio);
end
else begin radio.Destroy; radio:=nil; exit; end; end;
if listbox1.Selected[4] then begin //Panel
if checkbox1.Checked then begin
AssignFile(h,'h5.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(panel)) then begin
panel := TPanel.Create(Form1);
panel.Parent := Form1;
panel.Left := x;
panel.Top := y;
panel.Visible := True;
last:=5;
panel.Height := 30;
panel.Width := 80;
panel.Name := 'Panel';
panel.OnMouseDown := ComponentMouseDown;
panel.OnMouseMove := ComponentMouseMove;
panel.OnMouseUp := ComponentMouseUp;
SetProperties(panel);
end
else begin panel.Destroy; panel:=nil; exit; end; end;
if listbox1.Selected[5] then begin //ProgressBar
if checkbox1.Checked then begin
AssignFile(h,'h6.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(progress)) then begin
progress := TProgressBar.Create(Form1);
progress.Parent := Form1;
progress.Left := x;
progress.Top := y;
progress.Visible := True;
last:=6;
progress.Height := 30;
progress.Width := 80;
progress.Name := 'ProgressBar';
progress.OnMouseDown := ComponentMouseDown;
progress.OnMouseMove := ComponentMouseMove;
progress.OnMouseUp := ComponentMouseUp;
SetProperties(progress);
end
else begin progress.Destroy; progress:=nil; exit; end; end;
if listbox1.Selected[6] then begin //BitBtn
if checkbox1.Checked then begin
AssignFile(h,'h7.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(bitBtn)) then begin
bitBtn := TBitBtn.Create(Form1);
bitBtn.Parent := Form1;
bitBtn.Left := x;
bitBtn.Top := y;
bitBtn.Visible := True;
last:=7;
bitBtn.Height := 30;
bitBtn.Width := 80;
bitBtn.Name := 'BitButton';
bitBtn.OnMouseDown := ComponentMouseDown;
bitBtn.OnMouseMove := ComponentMouseMove;
bitBtn.OnMouseUp := ComponentMouseUp;
SetProperties(bitBtn);
end
else begin bitBtn.Destroy; bitBtn:=nil; exit; end; end;
if listbox1.Selected[7] then begin //Label
if checkbox1.Checked then begin
AssignFile(h,'h8.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(labelBox)) then begin
labelBox := TLabel.Create(Form1);
labelBox.Parent := Form1;
labelBox.Left := x;
labelBox.Top := y;
labelBox.Visible := True;
last:=8;
labelBox.Height := 130;
labelBox.Width := 80;
labelBox.Name := 'Label';
labelBox.OnMouseDown := ComponentMouseDown;
labelBox.OnMouseMove := ComponentMouseMove;
labelBox.OnMouseUp := ComponentMouseUp;
SetProperties(labelBox);
end
else begin labelBox.Destroy; labelBox:=nil; exit; end; end;
if listbox1.Selected[8] then begin //labeledEdit
if checkbox1.Checked then begin
AssignFile(h,'h9.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(labeledEdit)) then begin
labeledEdit := TLabeledEdit.Create(Form1);
labeledEdit.Parent := Form1;
labeledEdit.Left := x + 60;
labeledEdit.Top := y;
labeledEdit.Visible := True;
last:=9;
labeledEdit.Height := 30;
labeledEdit.Width := 80;
labeledEdit.Name := 'LabeledEdit';
labeledEdit.EditLabel.Caption:= 'LabeledEdit';
labeledEdit.OnMouseDown := ComponentMouseDown;
labeledEdit.OnMouseMove := ComponentMouseMove;
labeledEdit.OnMouseUp := ComponentMouseUp;
SetProperties(labeledEdit);
end
else begin labeledEdit.Destroy; labeledEdit:=nil; exit; end; end;
if listbox1.Selected[9] then begin //GroupBox
if checkbox1.Checked then begin
AssignFile(h,'h10.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(groupBox)) then begin
groupBox := TGroupBox.Create(Form1);
groupBox.Parent := Form1;
groupBox.Left := x;
groupBox.Top := y;
groupBox.Visible := True;
last:=10;
groupBox.Height := 130;
groupBox.Width := 80;
groupBox.Name := 'GroupBox';
groupBox.OnMouseDown := ComponentMouseDown;
groupBox.OnMouseMove := ComponentMouseMove;
groupBox.OnMouseUp := ComponentMouseUp;
SetProperties(groupBox);
end
else begin groupBox.Destroy; groupBox:=nil; exit; end; end;
if listbox1.Selected[10] then begin //Memo
if checkbox1.Checked then begin
AssignFile(h,'h11.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(memoBox)) then begin
memoBox := TMemo.Create(Form1);
memoBox.Parent := Form1;
memoBox.Left := x;
memoBox.Top := y;
memoBox.Visible := True;
last:=11;
memoBox.Height := 80;
memoBox.Width := 80;
memoBox.Name := 'Memo';
memoBox.OnMouseDown := ComponentMouseDown;
memoBox.OnMouseMove := ComponentMouseMove;
memoBox.OnMouseUp := ComponentMouseUp;
SetProperties(memoBox);
end
else begin memoBox.Destroy; memoBox:=nil; exit; end; end;
if listbox1.Selected[11] then begin //SpeedButton
if checkbox1.Checked then begin
AssignFile(h,'h12.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(speedBtn)) then begin
speedBtn := TSpeedButton.Create(Form1);
speedBtn.Parent := Form1;
speedBtn.Left := x;
speedBtn.Top := y;
speedBtn.Visible := True;
last:=12;
speedBtn.Height := 30;
speedBtn.Width := 80;
speedBtn.Name := 'SpeedButton';
speedBtn.OnMouseDown := ComponentMouseDown;
speedBtn.OnMouseMove := ComponentMouseMove;
speedBtn.OnMouseUp := ComponentMouseUp;
SetProperties(speedBtn);
end
else begin speedBtn.Destroy; speedBtn:=nil; exit; end; end;
if listbox1.Selected[12] then begin //Shape
if checkbox1.Checked then begin
AssignFile(h,'h13.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(shape)) then begin
shape := TShape.Create(Form1);
shape.Parent := Form1;
shape.Left := x;
shape.Top := y;
shape.Visible := True;
last:=13;
shape.Height := 30;
shape.Width := 80;
shape.Name := 'Shape';
shape.OnMouseDown := ComponentMouseDown;
shape.OnMouseMove := ComponentMouseMove;
shape.OnMouseUp := ComponentMouseUp;
SetProperties(shape);
end
else begin shape.Destroy; shape:=nil; exit; end; end;
if listbox1.Selected[13] then begin //staticText
if checkbox1.Checked then begin
AssignFile(h,'h14.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(staticText)) then begin
staticText := TStaticText.Create(Form1);
staticText.Parent := Form1;
staticText.Left := x;
staticText.Top := y;
staticText.Visible := True;
last:=14;
staticText.Height := 130;
staticText.Width := 80;
staticText.Name := 'StaticText';
staticText.OnMouseDown := ComponentMouseDown;
staticText.OnMouseMove := ComponentMouseMove;
staticText.OnMouseUp := ComponentMouseUp;
SetProperties(staticText);
end
else begin staticText.Destroy; staticText:=nil; exit; end; end;
if listbox1.Selected[14] then begin //stringGrid
if checkbox1.Checked then begin
AssignFile(h,'h15.txt');
reset(h);
read(h,shelp);
showmessage(shelp);
closeFile(h);
end;
if not(Assigned(stringGrid)) then begin
stringGrid := TStringGrid.Create(Form1);
stringGrid.Parent := Form1;
stringGrid.Left := x;
stringGrid.Top := y + 50;
stringGrid.Visible := True;
last:=15;
stringGrid.Height := 150;
stringGrid.Width := 200;
stringGrid.Name := 'StringGrid';
stringGrid.Col:=3;
stringGrid.Row:=2;
stringGrid.OnMouseDown := ComponentMouseDown;
stringGrid.OnMouseMove := ComponentMouseMove;
stringGrid.OnMouseUp := ComponentMouseUp;
SetProperties(stringGrid);
end
else begin stringGrid.Destroy; stringGrid:=nil; exit; end; end;
end;
procedure TForm1.ComponentMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Dragg := True;
XOffset := X;
YOffset := Y;
if Sender.ClassType = TButton then begin colorbox1.Enabled:=false; last:=1;
Selected_Component := Sender as TButton; end;
if Sender.ClassType = TEdit then begin colorbox1.Enabled:=true; last:=2;
Selected_Component := Sender as TEdit; end;
if Sender.ClassType = TCheckBox then begin colorbox1.Enabled:=false; last:=3;
Selected_Component := Sender as TCheckBox; end;
if Sender.ClassType = TRadioButton then begin colorbox1.Enabled:=false; last:=4;
Selected_Component := Sender as TRadioButton; end;
if Sender.ClassType = TPanel then begin colorbox1.Enabled:=true; last:=5;
Selected_Component := Sender as TPanel; end;
if Sender.ClassType = TProgressBar then begin colorbox1.Enabled:=false; last:=6;
Selected_Component := Sender as TProgressBar; end;
if Sender.ClassType = TBitBtn then begin colorbox1.Enabled:=true; last:=7;
Selected_Component := Sender as TBitBtn; end;
if Sender.ClassType = TLabel then begin colorbox1.Enabled:=true; last:=8;
Selected_Component := Sender as TLabel; end;
if Sender.ClassType = TLabeledEdit then begin colorbox1.Enabled:=true; last:=9;
Selected_Component := Sender as TLabeledEdit; end;
if Sender.ClassType = TGroupBox then begin colorbox1.Enabled:=false; last:=10;
Selected_Component := Sender as TGroupBox; end;
if Sender.ClassType = TMemo then begin colorbox1.Enabled:=true; last:=11;
Selected_Component := Sender as TMemo; end;
if Sender.ClassType = TSpeedButton then begin colorbox1.Enabled:=false;last:=12;
Selected_Component := Sender as TSpeedButton;end;
if Sender.ClassType = TShape then begin colorbox1.Enabled:=false; last:=13;
Selected_Component := Sender as TShape; end;
if Sender.ClassType = TStaticText then begin colorbox1.Enabled:=false; last:=14;
Selected_Component := Sender as TStaticText;end;
if Sender.ClassType = TStringGrid then begin colorbox1.Enabled:=false; last:=15;
Selected_Component := Sender as TStringGrid; end;
SetProperties(Selected_Component);
with Selected_Component do
FocusRect := Rect(Left, Top, Left + Width, Top + Height);
Canvas.DrawFocusRect(FocusRect);
end;
procedure TForm1.ComponentMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if Dragg then
begin
Canvas.DrawFocusRect(FocusRect);
with FocusRect do
begin
Left := (Selected_Component.Left + X) - XOffset;
Top := (Selected_Component.Top + Y) - YOffset;
Right := Selected_Component.Width + Left;
Bottom := Selected_Component.Height + Top;
end;
Canvas.DrawFocusRect(FocusRect);
StatusBar1.SimpleText := 'x = ' + IntToStr((Selected_Component.Left + X) - XOffset) +
' y = ' + IntToStr((Selected_Component.Top + Y) - YOffset);
end;
end;
procedure TForm1.ComponentMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Dragg then
begin
Canvas.DrawFocusRect(FocusRect); //Erase Focus Rect
Dragg := False;
with Selected_Component do
begin
Left := (Left + X) - XOffset;
Top := (Top + Y) - YOffset;
if Left<120 then Left:=120;
if Left>900-Width then Left:=900-Width;
if Top<65 then Top:=65;
if Top>440-Height-20 then Top:=440-Height-20;
end;
SetProperties(Selected_Component);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var vari:integer;
begin
if (Edit1.Text='')or(Edit2.Text='')or(Edit3.Text='')or(Edit1.Text='') then begin showmessage('Выберите компонент!'); Exit; end
else begin
if (not(TryStrToInt(Edit1.Text,vari)))or(not(TryStrToInt(Edit2.Text,vari)))or(not(TryStrToInt(Edit3.Text,vari)))or(not(TryStrToInt(Edit1.Text,vari))) then begin showmessage('Введите целое число!'); Exit; end;
Selected_Component.Left:=StrToInt(Edit1.Text);
Selected_Component.Top:=StrToInt(Edit2.Text);
Selected_Component.Height:=StrToInt(Edit3.Text);
Selected_Component.Width:=StrToInt(Edit4.Text);
if Selected_Component.Left<120 then Selected_Component.Left:=120;
if Selected_Component.Left>900-Selected_Component.Width then Selected_Component.Left:=900-Selected_Component.Width;
if Selected_Component.Top<65 then Selected_Component.Top:=65;
if Selected_Component.Top>440-Selected_Component.Height-20 then Top:=440-Selected_Component.Height-20;
case last of
2: begin textBox.Font.Color:=ColorBox1.Selected; end;
5: begin panel.Font.Color:=ColorBox1.Selected; end;
7: begin bitBtn.Font.Color:=ColorBox1.Selected; end;
8: begin labelBox.Font.Color:=ColorBox1.Selected; end;
9: begin labeledEdit.Font.Color:=ColorBox1.Selected; end;
11: begin memoBox.Font.Color:=ColorBox1.Selected; end;
else ColorBox1.enabled:=false;
end;
end;
SetProperties(Selected_Component);
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var f: textfile;
begin
AssignFile(f,{GetCurrentDir+}'save.txt');
Rewrite(f);
if Assigned(button) then //1
begin
writeln(f,button.Top);
writeln(f,button.Left);
writeln(f,button.Height);
writeln(f,button.Width);
end
else writeln(f,'0');
if (Assigned(textBox))and(textBox.Visible) then //2
begin
writeln(f,textBox.Top);
writeln(f,textBox.Left);
writeln(f,textBox.Height);
writeln(f,textBox.Width);
writeln(f,textBox.Font.Color);
end
else writeln(f,'0');
if (Assigned(checkBox))and(checkBox.Visible) then //3
begin
writeln(f,checkBox.Top);
writeln(f,checkBox.Left);
writeln(f,checkBox.Height);
writeln(f,checkBox.Width);
end
else writeln(f,'0');
if (Assigned(radio))and(radio.Visible) then //4
begin
writeln(f,radio.Top);
writeln(f,radio.Left);
writeln(f,radio.Height);
writeln(f,radio.Width);
end
else writeln(f,'0');
if (Assigned(panel))and(panel.Visible) then //5
begin
writeln(f,panel.Top);
writeln(f,panel.Left);
writeln(f,panel.Height);
writeln(f,panel.Width);
writeln(f,panel.Font.Color);
end
else writeln(f,'0');
if (Assigned(progress))and(progress.Visible) then //6
begin
writeln(f,progress.Top);
writeln(f,progress.Left);
writeln(f,progress.Height);
writeln(f,progress.Width);
end
else writeln(f,'0');
if (Assigned(bitBtn))and(bitBtn.Visible) then //7
begin
writeln(f,bitBtn.Top);
writeln(f,bitBtn.Left);
writeln(f,bitBtn.Height);
writeln(f,bitBtn.Width);
writeln(f,bitBtn.Font.Color);
end
else writeln(f,'0');
if (Assigned(labelBox))and(labelBox.Visible) then //8
begin
writeln(f,labelBox.Top);
writeln(f,labelBox.Left);
writeln(f,labelBox.Height);
writeln(f,labelBox.Width);
writeln(f,labelBox.Font.Color);
end
else writeln(f,'0');
if (Assigned(labeledEdit))and(labeledEdit.Visible) then //9
begin
writeln(f,labeledEdit.Top);
writeln(f,labeledEdit.Left);
writeln(f,labeledEdit.Height);
writeln(f,labeledEdit.Width);
writeln(f,labeledEdit.Font.Color);
end
else writeln(f,'0');
if (Assigned(groupBox))and(groupBox.Visible) then //10
begin
writeln(f,groupBox.Top);
writeln(f,groupBox.Left);
writeln(f,groupBox.Height);
writeln(f,groupBox.Width);
end
else writeln(f,'0');
if (Assigned(memoBox))and(memoBox.Visible) then //11
begin
writeln(f,memoBox.Top);
writeln(f,memoBox.Left);
writeln(f,memoBox.Height);
writeln(f,memoBox.Width);
writeln(f,memoBox.Font.Color);
end
else writeln(f,'0');
if (Assigned(speedBtn))and(speedBtn.Visible) then //12
begin
writeln(f,speedBtn.Top);
writeln(f,speedBtn.Left);
writeln(f,speedBtn.Height);
writeln(f,speedBtn.Width);
end
else writeln(f,'0');
if (Assigned(shape))and(shape.Visible) then //13
begin
writeln(f,shape.Top);
writeln(f,shape.Left);
writeln(f,shape.Height);
writeln(f,shape.Width);
end
else writeln(f,'0');
if (Assigned(staticText))and(staticText.Visible) then //14
begin
writeln(f,staticText.Top);
writeln(f,staticText.Left);
writeln(f,staticText.Height);
writeln(f,staticText.Width);
end
else writeln(f,'0');
if (Assigned(stringGrid))and(stringGrid.Visible) then //15
begin
writeln(f,stringGrid.Top);
writeln(f,stringGrid.Left);
writeln(f,stringGrid.Height);
writeln(f,stringGrid.Width);
end
else writeln(f,'0');
CloseFile(f);
end;
procedure TForm1.clear_all;
begin
Edit1.Text:='';Edit2.Text:='';Edit3.Text:='';Edit4.Text:='';
if Assigned(button) then begin button.Destroy; button:=nil; end;
if Assigned(textBox) then begin textBox.Destroy; textBox:=nil; end;
if Assigned(checkBox) then begin checkBox.Destroy; checkBox:=nil; end;
if Assigned(radio) then begin radio.Destroy; radio:=nil; end;
if Assigned(panel) then begin panel.Destroy; panel:=nil; end;
if Assigned(progress) then begin progress.Destroy; progress:=nil; end;
if Assigned(bitBtn) then begin bitBtn.Destroy; bitBtn:=nil; end; //7
if Assigned(labelBox) then begin labelBox.Destroy; labelBox:=nil; end;
if Assigned(labeledEdit) then begin labeledEdit.Destroy; labeledEdit:=nil; end;
if Assigned(groupBox) then begin groupBox.Destroy; groupBox:=nil; end;//10
if Assigned(memoBox) then begin memoBox.Destroy; memoBox:=nil; end; //11
if Assigned(speedBtn) then begin speedBtn.Destroy; speedBtn:=nil; end; //12
if Assigned(shape) then begin shape.Destroy; shape:=nil; end; //13
if Assigned(staticText) then begin staticText.Destroy; staticText:=nil; end; //14
if Assigned(stringGrid) then begin stringGrid.Destroy; stringGrid:=nil; end; //15
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
clear_all;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
var f: textfile; tmp:integer; sig: TColor;
begin
clear_all;
AssignFile(f,{GetCurrentDir+}'save.txt');
Reset(f);
readln(f,tmp);
if tmp<>0 then begin //button
if NOT(Assigned(button)) then begin
button := TButton.Create(Form1);
button.Parent := Form1;
button.OnMouseDown := ComponentMouseDown;
button.OnMouseMove := ComponentMouseMove;
button.OnMouseUp := ComponentMouseUp;
button.Name := 'Button';
end;
button.Top:=tmp;
readln(f,tmp);
button.Left:=tmp;
readln(f,tmp);
button.Height:=tmp;
readln(f,tmp);
button.Width:=tmp;
// SetProperties(button);
button.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //textBox
if NOT(Assigned(textBox)) then begin
textBox := TEdit.Create(Form1);
textBox.Parent := Form1;
textBox.OnMouseDown := ComponentMouseDown;
textBox.OnMouseMove := ComponentMouseMove;
textBox.OnMouseUp := ComponentMouseUp;
textBox.Name := 'TextBox';
end;
textBox.Top:=tmp;
readln(f,tmp);
textBox.Left:=tmp;
readln(f,tmp);
textBox.Height:=tmp;
readln(f,tmp);
textBox.Width:=tmp;
readln(f,sig);
textBox.Font.Color:=sig;
// SetProperties(textBox);
textBox.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //checkBox
if NOT(Assigned(checkBox)) then begin
checkBox := TCheckBox.Create(Form1);
checkBox.Parent := Form1;
checkBox.OnMouseDown := ComponentMouseDown;
checkBox.OnMouseMove := ComponentMouseMove;
checkBox.OnMouseUp := ComponentMouseUp;
checkBox.Name := 'CheckBox';
end;
checkBox.Top:=tmp;
readln(f,tmp);
checkBox.Left:=tmp;
readln(f,tmp);
checkBox.Height:=tmp;
readln(f,tmp);
checkBox.Width:=tmp;
// SetProperties(checkBox);
checkBox.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //radio
if NOT(Assigned(radio)) then begin
radio := TRadioButton.Create(Form1);
radio.Parent := Form1;
radio.OnMouseDown := ComponentMouseDown;
radio.OnMouseMove := ComponentMouseMove;
radio.OnMouseUp := ComponentMouseUp;
radio.Name := 'RadioButton';
end;
radio.Top:=tmp;
readln(f,tmp);
radio.Left:=tmp;
readln(f,tmp);
radio.Height:=tmp;
readln(f,tmp);
radio.Width:=tmp;
// SetProperties(radio);
radio.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //panel
if NOT(Assigned(panel)) then begin
panel := TPanel.Create(Form1);
panel.Parent := Form1;
panel.OnMouseDown := ComponentMouseDown;
panel.OnMouseMove := ComponentMouseMove;
panel.OnMouseUp := ComponentMouseUp;
panel.Name := 'Panel';
end;
panel.Top:=tmp;
readln(f,tmp);
panel.Left:=tmp;
readln(f,tmp);
panel.Height:=tmp;
readln(f,tmp);
panel.Width:=tmp;
readln(f,sig);
panel.Font.Color:=sig;
// SetProperties(panel);
panel.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //progress
if NOT(Assigned(progress)) then begin
progress := TProgressBar.Create(Form1);
progress.Parent := Form1;
progress.OnMouseDown := ComponentMouseDown;
progress.OnMouseMove := ComponentMouseMove;
progress.OnMouseUp := ComponentMouseUp;
progress.Name := 'ProgressBar';
end;
progress.Top:=tmp;
readln(f,tmp);
progress.Left:=tmp;
readln(f,tmp);
progress.Height:=tmp;
readln(f,tmp);
progress.Width:=tmp;
// SetProperties(progress);
progress.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //bitBtn
if NOT(Assigned(bitBtn)) then begin
bitBtn := TBitBtn.Create(Form1);
bitBtn.Parent := Form1;
bitBtn.OnMouseDown := ComponentMouseDown;
bitBtn.OnMouseMove := ComponentMouseMove;
bitBtn.OnMouseUp := ComponentMouseUp;
bitBtn.Name := 'BitBtn';
end;
bitBtn.Top:=tmp;
readln(f,tmp);
bitBtn.Left:=tmp;
readln(f,tmp);
bitBtn.Height:=tmp;
readln(f,tmp);
bitBtn.Width:=tmp;
readln(f,sig);
bitBtn.Font.Color:=sig;
// SetProperties(bitBtn);
bitBtn.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //labelBox
if NOT(Assigned(labelBox)) then begin
labelBox := TLabel.Create(Form1);
labelBox.Parent := Form1;
labelBox.OnMouseDown := ComponentMouseDown;
labelBox.OnMouseMove := ComponentMouseMove;
labelBox.OnMouseUp := ComponentMouseUp;
labelBox.Name := 'Label';
end;
labelBox.Top:=tmp;
readln(f,tmp);
labelBox.Left:=tmp;
readln(f,tmp);
labelBox.Height:=tmp;
readln(f,tmp);
labelBox.Width:=tmp;
readln(f,sig);
labelbox.Font.Color:=sig;
// SetProperties(labelBox);
labelBox.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //labeledEdit
if NOT(Assigned(labeledEdit)) then begin
labeledEdit := TLabeledEdit.Create(Form1);
labeledEdit.Parent := Form1;
labeledEdit.OnMouseDown := ComponentMouseDown;
labeledEdit.OnMouseMove := ComponentMouseMove;
labeledEdit.OnMouseUp := ComponentMouseUp;
labeledEdit.Name := 'LabeledEdit';
end;
labeledEdit.Top:=tmp;
readln(f,tmp);
labeledEdit.Left:=tmp;
readln(f,tmp);
labeledEdit.Height:=tmp;
readln(f,tmp);
labeledEdit.Width:=tmp;
readln(f,sig);
labeledEdit.Font.Color:=sig;
// SetProperties(labeledEdit);
labeledEdit.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //groupBox
if NOT(Assigned(groupBox)) then begin
groupBox := TGroupBox.Create(Form1);
groupBox.Parent := Form1;
groupBox.OnMouseDown := ComponentMouseDown;
groupBox.OnMouseMove := ComponentMouseMove;
groupBox.OnMouseUp := ComponentMouseUp;
groupBox.Name := 'GroupBox';
end;
groupBox.Top:=tmp;
readln(f,tmp);
groupBox.Left:=tmp;
readln(f,tmp);
groupBox.Height:=tmp;
readln(f,tmp);
groupBox.Width:=tmp;
// SetProperties(groupBox);
groupBox.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //memoBox
if NOT(Assigned(memoBox)) then begin
memoBox := TMemo.Create(Form1);
memoBox.Parent := Form1;
memoBox.OnMouseDown := ComponentMouseDown;
memoBox.OnMouseMove := ComponentMouseMove;
memoBox.OnMouseUp := ComponentMouseUp;
memoBox.Name := 'Memo';
end;
memoBox.Top:=tmp;
readln(f,tmp);
memoBox.Left:=tmp;
readln(f,tmp);
memoBox.Height:=tmp;
readln(f,tmp);
memoBox.Width:=tmp;
readln(f,sig);
memoBox.Font.Color:=sig;
// SetProperties(memoBox);
memoBox.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //speedBtn
if NOT(Assigned(speedBtn)) then begin
speedBtn := TSpeedButton.Create(Form1);
speedBtn.Parent := Form1;
speedBtn.OnMouseDown := ComponentMouseDown;
speedBtn.OnMouseMove := ComponentMouseMove;
speedBtn.OnMouseUp := ComponentMouseUp;
speedBtn.Name := 'SpeedButton';
end;
speedBtn.Top:=tmp;
readln(f,tmp);
speedBtn.Left:=tmp;
readln(f,tmp);
speedBtn.Height:=tmp;
readln(f,tmp);
speedBtn.Width:=tmp;
// SetProperties(speedBtn);
speedBtn.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //shape
if NOT(Assigned(shape)) then begin
shape := TShape.Create(Form1);
shape.Parent := Form1;
shape.OnMouseDown := ComponentMouseDown;
shape.OnMouseMove := ComponentMouseMove;
shape.OnMouseUp := ComponentMouseUp;
shape.Name := 'Shape';
end;
shape.Top:=tmp;
readln(f,tmp);
shape.Left:=tmp;
readln(f,tmp);
shape.Height:=tmp;
readln(f,tmp);
shape.Width:=tmp;
// SetProperties(shape);
shape.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //staticText
if NOT(Assigned(staticText)) then begin
staticText := TStaticText.Create(Form1);
staticText.Parent := Form1;
staticText.OnMouseDown := ComponentMouseDown;
staticText.OnMouseMove := ComponentMouseMove;
staticText.OnMouseUp := ComponentMouseUp;
staticText.Name := 'StaticText';
end;
staticText.Top:=tmp;
readln(f,tmp);
staticText.Left:=tmp;
readln(f,tmp);
staticText.Height:=tmp;
readln(f,tmp);
staticText.Width:=tmp;
//SetProperties(staticText);
staticText.Visible:=true;
end;
readln(f,tmp);
if tmp<>0 then begin //stringGrid
if NOT(Assigned(stringGrid)) then begin
stringGrid := TStringGrid.Create(Form1);
stringGrid.Parent := Form1;
stringGrid.OnMouseDown := ComponentMouseDown;
stringGrid.OnMouseMove := ComponentMouseMove;
stringGrid.OnMouseUp := ComponentMouseUp;
stringGrid.Name := 'StringGrid';
end;
stringGrid.Top:=tmp;
readln(f,tmp);
stringGrid.Left:=tmp;
readln(f,tmp);
stringGrid.Height:=tmp;
readln(f,tmp);
stringGrid.Width:=tmp;
SetProperties(stringGrid);
stringGrid.Visible:=true;
end;
CloseFile(f);
end;
procedure TForm1.BitBtn5Click(Sender: TObject);
begin
Showmessage(‘Справка по компонентам библиотеки VLC Deflphi 7. Разработал Брик Михаил. Воронеж 2013');
end;
end.