
10.03.2009, 22:04
|
 |
Гуру
|
|
Регистрация: 09.03.2009
Адрес: На курорте, из окна вижу теплое Баренцево море. Бррр.
Сообщения: 4,723
Репутация: 52347
|
|
Ну вот вам вариант:
Код:
unit Unit34;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm34 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Memo1: TMemo;
ProgressBar1: TProgressBar;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
Dictionary: TStringList;
end;
var
Form34: TForm34;
implementation
{$R *.dfm}
procedure TForm34.Button1Click(Sender: TObject);
Var
i: Integer;
begin
Memo1.Clear;
ProgressBar1.Position := 0;
for i := 0 to Dictionary.Count - 1
do begin
if Pos(AnsiUpperCase(Dictionary.Strings[i]), AnsiUpperCase(Edit1.Text)) <> 0
then Memo1.Lines.Add(Dictionary.Strings[i]);
ProgressBar1.StepIt;
Application.ProcessMessages;
end;
end;
procedure TForm34.FormCreate(Sender: TObject);
begin
Dictionary := TStringList.Create;
Dictionary.LoadFromFile('C:\Dictionary.txt');
Dictionary.Sort;
ProgressBar1.Max := Dictionary.Count;
Label1.Caption := Format('В словаре %d слов',[Dictionary.Count]);
end;
end.
и dfm-файл к нему.
object Form33: TForm33
Left = 0
Top = 0
Caption = 'Form33'
ClientHeight = 341
ClientWidth = 643
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
DesignSize = (
643
341)
PixelsPerInch = 96
TextHeight = 13
object SimpleGraph1: TSimpleGraph
Left = 8
Top = 8
Width = 627
Height = 265
Anchors = [akLeft, akTop, akRight, akBottom]
ShowGrid = False
TabOrder = 0
end
object Button1: TButton
Left = 8
Top = 308
Width = 75
Height = 25
Anchors = [akLeft, akBottom]
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object ProgressBar1: TProgressBar
Left = 8
Top = 285
Width = 627
Height = 17
Anchors = [akLeft, akRight, akBottom]
Step = 1
TabOrder = 2
end
end
Admin: Пользуемся тегами!!!
|