Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > IT форум > Помощь студентам
Регистрация

Восстановить пароль

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 11.03.2012, 11:11   #1
Queit72ru
 
Регистрация: 30.11.2011
Сообщений: 6
Восклицание Нити

Модеры извенить заранее незнаю куда расместить тему=)
Тут задачку накаталв делфи но не могу вкл кнопку финиш....
подскажите что как написать или исправить...
Сяп зарание..=)
PHP код:
unit Unit1;

interface

uses
  Windows
MessagesSysUtilsVariantsClassesGraphicsControlsForms,
  
DialogsStdCtrlsExtCtrlsunit2;

type
  TForm1 
= class(TForm)
    
PaintBox1TPaintBox;
    
PaintBox2TPaintBox;
    
PaintBox3TPaintBox;
    
Button1TButton;
    
Button2TButton;
    
procedure Button1Click(SenderTObject);
    
procedure Button2Click(SenderTObject);
  private
    { Private 
declarations }
  public
    
procedure VivodFigur1;
    
procedure VivodFigur2;
    
procedure VivodFigur3;
    
procedure VivodFigur(VFTCanvas);
  
end;

var
  
Form1TForm1;
  
P1,P2,P3Potok;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(SenderTObject);
begin
  
// создание первого потока
  
P1:=Potok.Create(true);
  
P1.Priority:=tpHighest;
  
P1.NPotoka:=1;
  
// создание второго потока
  
P2:=Potok.Create(true);
  
P2.Priority:=tpNormal;
  
P2.NPotoka:=2;
  
// создание третьего потока
  
P3:=Potok.Create(true);
  
P3.Priority:=tpHigher;
  
P3.NPotoka:=3;
  
// запуск трех потоков
  
P1.ResumeP2.ResumeP3.Resume;
end;

procedure TForm1.VivodFigur(VFTCanvas);
var 
FTrect;
begin
  VF
.Brush.Style:=bsSolid;
  
VF.Brush.Color:=rgb(random(256),random(256),random(256));
  
F.Left:=random(90);
  
F.Top:=random(90);
  
F.Right:=F.Left+10;
  
F.Bottom:=F.Top+10;
  
VF.Rectangle(F);
end;

procedure TForm1.VivodFigur1;
begin
  VivodFigur
(PaintBox1.Canvas);
end;

procedure TForm1.VivodFigur2;
begin
  VivodFigur
(PaintBox2.Canvas);
end;

procedure TForm1.VivodFigur3;
begin
  VivodFigur
(PaintBox3.Canvas);
end;

procedure TForm1.Button2Click(SenderTObject);
begin
  Application
.Terminate;
end;

end
PHP код:
 unit Unit2;

interface

uses
  Classes
;

type
  Potok 
= class(TThread)
  private
    { Private 
declarations }
  protected
    
procedure Executeoverride;
  public
    
NPotokabyte;
  
end;

implementation

uses unit1
;

ImportantMethods and properties of objects in visual components can only be
  used in a method called using Synchronize
, for example,

      
Synchronize(UpdateCaption);

  and 
UpdateCaption could look like,

    
procedure Potok.UpdateCaption;
    
begin
      Form1
.Caption := 'Updated in a thread';
    
end; }

Potok }

procedure Potok.Execute;
begin
  
while not terminated do
  
begin
    
case NPotoka of
    1
synchronize(form1.VivodFigur1);
    
2synchronize(form1.VivodFigur2);
    
3synchronize(form1.VivodFigur3);
    
end// case
  
end;  // while

end;

end
PHP код:
object Form1TForm1
  Left 
192
  Top 
114
  Width 
708
  Height 
340
  Caption 
#1053#1080#1090#1080
  
Color clBtnFace
  Font
.Charset DEFAULT_CHARSET
  Font
.Color clWindowText
  Font
.Height = -11
  Font
.Name 'MS Sans Serif'
  
Font.Style = []
  
OldCreateOrder False
  PixelsPerInch 
96
  TextHeight 
13
  object PaintBox1
TPaintBox
    Left 
72
    Top 
40
    Width 
100
    Height 
100
  end
  object PaintBox2
TPaintBox
    Left 
216
    Top 
40
    Width 
100
    Height 
100
  end
  object PaintBox3
TPaintBox
    Left 
360
    Top 
40
    Width 
100
    Height 
100
  end
  object Button1
TButton
    Left 
512
    Top 
40
    Width 
75
    Height 
25
    Caption 
#1057#1090#1072#1088#1090
    
TabOrder 0
    OnClick 
Button1Click
  end
  object Button2
TButton
    Left 
512
    Top 
88
    Width 
75
    Height 
25
    Caption 
#1060#1080#1085#1080#1096
    
TabOrder 1
    OnClick 
Button2Click
  end
end 

Последний раз редактировалось Queit72ru; 11.03.2012 в 11:13.
Queit72ru вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Построить ломаную линию по заданныи вершинам. Вершины указываются с клавиатуры по «методу резиновой нити». HollywoodStar Паскаль, Turbo Pascal, PascalABC.NET 0 17.12.2011 14:36
Нити в процессе JustLikeFar Win Api 6 23.08.2009 17:32
В среде Delphi составить программу (процесс), который паралельно запускает два потока (нити) metamfetamin Помощь студентам 9 06.11.2007 15:26
Потоки и их "нити" Air Win Api 7 15.05.2007 20:17