Дерево-каталог в соответствии в соответствии с внутренним дисковым носителем 


Мы поможем в написании ваших работ!



ЗНАЕТЕ ЛИ ВЫ?

Дерево-каталог в соответствии в соответствии с внутренним дисковым носителем



TForm1 = class(TForm)

DirectoryListBox1: TDirectoryListBox;

DriveComboBox1: TDriveComboBox;

BitBtn1: TBitBtn;

procedure DriveComboBox1Change(Sender: TObject);

implementation

{$R *.dfm}

procedure TForm1.DriveComboBox1Change(Sender: TObject);

begin

DirectoryListBox1.Drive:=DriveComboBox1.Drive;

end;

end.

 

ВЫБОР РАЗМЕРА МАТРИЦЫ С ПОМОЩЬЮ КОМПОНЕНТА COMBOBOX. ВВОДА ЗНАЧЕНИЙ ЭЛЕМЕНТОВ МАТРИЦЫ В STRINGGRID. ВЫЧИСЛЕНИЕ СУММЫ ЧЕТНЫХ ЭЛЕМЕНТОВ МАТРИЦЫ

TForm1 = class(TForm)

ComboBox1: TComboBox;

Button1: TButton;

Button2: TButton;

Label1: TLabel;

StringGrid1: TStringGrid;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

var i,j:integer;

begin

case ComboBox1.ItemIndex of

0:begin for i:=0 to 4 do

for j:=0 to 4 do

StringGrid1.Cells[j,i]:=' ';

stringGrid1.RowCount:=3; StringGrid1.ColCount:=3; end;

1: begin for i:=0 to 4 do

for j:=0 to 4 do

StringGrid1.Cells[j,i]:=' ';

StringGrid1.RowCount:=4; StringGrid1.ColCount:=4; end;

2: begin for i:=0 to 4 do

for j:=0 to 4 do

StringGrid1.Cells[j,i]:=' ';

StringGrid1.RowCount:=5; StringGrid1.ColCount:=5; end;

end;

end;

procedure TForm1.Button2Click(Sender: TObject);

var i,j,s:integer;

begin

s:=0;

if ComboBox1.ItemIndex=0 then begin

for j:=0 to 2 do

for i:=0 to 2 do

begin

label1.Visible:=true;

label1.Caption:=stringgrid1.Cells[j,i];

if strtoint(label1.Caption) mod 2=0 then

begin

label1.Visible:=true;

s:=s+strtoint(StringGrid1.Cells[j,i]);

label1.Caption:=inttostr(s);

end;

end;

end;

end;

 

if ComboBox1.ItemIndex=1 then begin

for j:=0 to 3 do

for i:=0 to 3 do

begin

label1.Visible:=true;

label1.Caption:=stringgrid1.Cells[j,i];

if strtoint(label1.Caption) mod 2=0 then

begin

label1.Visible:=true;

s:=s+strtoint(StringGrid1.Cells[j,i]);

label1.Caption:=inttostr(s);

end;

end;

end;

end;

end.

 

Изменение шрифта при вводе в Edit

TForm1 = class(TForm)

Edit1: TEdit;

RadioGroup1: TRadioGroup;

RadioGroup2: TRadioGroup;

RadioGroup3: TRadioGroup;

Button1: TButton;

BitBtn1: TBitBtn;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

begin

if radiogroup1.ItemIndex=-1

then showmessage('Необходимо выбрать цвет шрифта!')else

case radiogroup1.ItemIndex of

0:begin edit1.Font.Color:=clRed;

end;

1:begin edit1.Font.Color:=clGreen;

end;

2:begin edit1.Font.Color:=clBlue;

end;

3:begin edit1.Font.Color:=clYellow;

end;

4:begin edit1.Font.Color:=clMaroon;

end;

end;

if radiogroup2.ItemIndex=-1

then showmessage('Необходимо выбрать начертание шрифта!')else

case radiogroup2.ItemIndex of

0:begin edit1.Font.Style:= [fsBold];

end;

1:begin edit1.Font.Style:= [fsItalic];

end;

2:begin edit1.Font.Style:= [fsUnderline];

end;

3:begin edit1.Font.Style:= [fsStrikeout];

end;

end;

if radiogroup3.ItemIndex=-1

then showmessage('Необходимо выбрать размер шрифта!')else

case radiogroup3.ItemIndex of

0:begin edit1.Font.Size:=8;

end;

1:begin edit1.Font.Size:=10;

end;

2:begin edit1.Font.Size:=12;

end;

3:begin edit1.Font.Size:=14;

end;

4:begin edit1.Font.Size:=15;

end;

5:begin edit1.Font.Size:=18;

end;

end;

end;

procedure TForm1.FormCreate(Sender: TObject);

begin

edit1.Clear

end;

end.

 

Изменение шрифтов в многострочном редакторе

TForm1 = class(TForm)

RadioGroup1: TRadioGroup;

RadioGroup2: TRadioGroup;

RadioGroup3: TRadioGroup;

Button1: TButton;

BitBtn1: TBitBtn;

Memo1: TMemo;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

begin

if radiogroup1.ItemIndex=-1

then showmessage('Необходимо выбрать цвет шрифта!')else

case radiogroup1.ItemIndex of

0:begin memo1.Font.Color:=clRed;

end;

1:begin memo1.Font.Color:=clGreen;

end;

2:begin memo1.Font.Color:=clBlue;

end;

3:begin memo1.Font.Color:=clYellow;

end;

4:begin memo1.Font.Color:=clMaroon;

end;

end;

if radiogroup2.ItemIndex=-1

then showmessage('Необходимо выбрать начертание шрифта!')else

case radiogroup2.ItemIndex of

0:begin memo1.Font.Style:= [fsBold];

end;

1:begin memo1.Font.Style:= [fsItalic];

end;

2:begin memo1.Font.Style:= [fsUnderline];

end;

3:begin memo1.Font.Style:= [fsStrikeout];

end;

end;

if radiogroup3.ItemIndex=-1

then showmessage('Необходимо выбрать размер шрифта!')else

case radiogroup3.ItemIndex of

0:begin memo1.Font.Size:=8;

end;

1:begin memo1.Font.Size:=10;

end;

2:begin memo1.Font.Size:=12;

end;

3:begin memo1.Font.Size:=14;

end;

4:begin memo1.Font.Size:=15;

end;

5:begin memo1.Font.Size:=18;

end;

end;

end;

procedure TForm1.FormCreate(Sender: TObject);

begin

memo1.Clear

end;

end.

 

Узнать имя файла дериктории и сделать ее текущей

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, ShellApi, FileCtrl, ExtCtrls, jpeg, Buttons, ComCtrls;

type

TForm1 = class(TForm)

FileListBox1: TFileListBox;

DirectoryListBox1: TDirectoryListBox;

DriveComboBox1: TDriveComboBox;

FileListBox2: TFileListBox;

DirectoryListBox2: TDirectoryListBox;

DriveComboBox2: TDriveComboBox;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

x,y: string;

iconindex:integer;

implementation

{$R *.dfm}

procedure CopyFiles(const FromFolder: string; const ToFolder: string);

var

Fo: TSHFileOpStruct;

buffer: array[0..4096] of char;

p: pchar;

begin

FillChar(Buffer, sizeof(Buffer), #0);

p:= @buffer;

StrECopy(p, PChar(FromFolder)); //директория, которую мы хотим скопировать

FillChar(Fo, sizeof(Fo), #0);

Fo.Wnd:= Application.Handle;

Fo.wFunc:= FO_COPY;

Fo.pFrom:= @Buffer;

Fo.pTo:= PChar(ToFolder); //куда будет скопирована директория

Fo.fFlags:= 0;

if ((SHFileOperation(Fo) <> 0) or (Fo.fAnyOperationsAborted <> false)) then

ShowMessage('File copy process cancelled')

end;

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

CopyFiles(directorylistbox1.Directory,Directorylistbox2.Directory);

Showmessage('Копирование завершено');

end;

procedure TForm1.BitBtn2Click(Sender: TObject);

begin

close;

end;

end.

 

 

Скрытый файл сделать видимым. Поменять атрибут.

Windows.setfileattributes(‘c:\test.txt’,fahidden); -сделать скрытым файл

программа

Function filesethidden(filename:string;hid:Boolean):Boolean;

Var flags:integer;

Begin

Result:=false;

Flags:=getfileattributes(pchar(filename));

If hid then flags:=flags or fahidden

Else flags:=flags and not fahidden;

Result:=setfileattributes(pchar(filename),flags);end;

Hid=true сделать файл скрытым

Hid=false сделать файл не скрытым

Сумма эл-тов ниже побочной диагонали

Var a: array[1..5,1..5] of integer;

Sum,I,j:integer;

Begin

For i:=1 to 5 do

For j:=1 to 5 do

A[i,j]:=strtoint(stringgrid1.cells[j-1,i-1];

Sum:=0;

If(5-j-1)<i then

Begin

Sum:=sum+a[I,j];

End;

При наведении мыши показывает сколько файлов содержится.

procedure TForm1.FileListBox1Change(Sender: TObject);

begin

memo1.Lines.Add(filelistbox1.FileName);

end;

procedure TForm1.DriveComboBox1Change(Sender: TObject);

begin

DirectoryListBox1.Drive:=DriveComboBox1.Drive;

end;

procedure TForm1.FilterComboBox1Change(Sender: TObject);

begin

filelistbox1.Mask:=filtercombobox1.Mask;

end;

Создание класса треугольника. Нахождение площади

Type

TTreug

private

fsidelength: integer;//dlina storony

fhidelength: integer;//vysota treuga

farea: integer;//plowad

procedure area;

procedure create;

end;

procedureTTreug.Create(length:integer);

begin

sidelength:=length;

hidelength:=length1;

end;

procedureTTreug.Area(a:integer);

a:=sidelength*hidelength/2;

end;

procedureTForm1.Button1.Click(Sender:TObject);

begin

sidelength:=strtoint(edit1.Text);

hidelength:=strtoint(edit2.Text);

Treug.Area(a);

label1.caption:=inttostr(a);

end;

14..строка состояния студента

statusbar1.Panels[0].Text:='Иванов Иван Иванович';

statusbar1.Panels[1].Text:=datetostr(now);

statusbar1.Panels[2].Text:=timetostr(now);

Объект машина. Старт и стоп движения

//Машина представляет собой рисунок

procedureTForm1.FormCreate(Sender:TObject);

Timer1.active:=false;

procedureTForm1.Timer1Timer(Sender:TObject);

begin

image1.left:=image1.left+50;

if(image1.left>form1.clientwidth) then

image1.left:=1;

end;

//stop mawina

procedureTForm1.Button1.Click(Sender:TObject);

begin

Timer1.active:=false;

end;

//go mawina

procedureTForm1.Button1.Click(Sender:TObject);

begin

Timer1.active:=true;

end;

end.



Поделиться:


Последнее изменение этой страницы: 2016-08-14; просмотров: 115; Нарушение авторского права страницы; Мы поможем в написании вашей работы!

infopedia.su Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. Обратная связь - 18.221.239.148 (0.024 с.)