Показать сообщение отдельно
  #3  
Старый 21.04.2008, 12:53
overclocker01 overclocker01 вне форума
Прохожий
 
Регистрация: 20.04.2008
Сообщения: 6
Репутация: 10
По умолчанию

че-т я не могу разобраться.. =((
Вот что я смог сделать вчера..

Для Form:
Код:
object Form1: TForm1
  Left = 193
  Top = 134
  Width = 673
  Height = 480
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  Menu = MainMenu1
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 3
    Top = 72
    Width = 3
    Height = 13
  end
  object Label2: TLabel
    Left = 144
    Top = 72
    Width = 3
    Height = 13
  end
  object Label3: TLabel
    Left = 0
    Top = 48
    Width = 207
    Height = 13
    Caption = 'Шифр                  Максимальный перепад давления'
  end
  object Label4: TLabel
    Left = 0
    Top = 288
    Width = 3
    Height = 13
  end
  object StringGrid1: TStringGrid
    Left = 296
    Top = 64
    Width = 201
    Height = 153
    ColCount = 3
    FixedCols = 0
    RowCount = 6
    TabOrder = 0
    RowHeights = (
      24
      24
      24
      24
      24
      24)
  end
  object MainMenu1: TMainMenu
    object N1: TMenuItem
      Caption = 'Файл'
      object N3: TMenuItem
        Caption = 'Исходные данные'
        OnClick = N3Click
      end
      object max1: TMenuItem
        Caption = 'max перепад давления'
        Enabled = False
        OnClick = max1Click
      end
      object N51: TMenuItem
        Caption = Перепад давления 5Мпа'
      end
    end
    object N2: TMenuItem
      Caption = 'Выход'
      OnClick = N2Click
    end
  end
end

Программа:
Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Menus, Grids;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    max1: TMenuItem;
    N51: TMenuItem;
    StringGrid1: TStringGrid;
    procedure N3Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure max1Click(Sender: TObject);
    procedure N51Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  max:real;
  n:real;
  i:integer;
  shifr:array[1..16] of string=('А6ГТШ','А7ГТШ','А7ГТШ-ТЛ','А7Ш','А9ГТШ-ТЛ','А09Ш','ЗТСШ1-172','ЗТСШ1-195','ЗТСШ1-195ТЛ','ЗТСШ-195','ЗТСШ-240','Т12МЗБ-195','Т12МЗБ-215','Т12МЗБ-240','Т12МЗЕ-172','ТС5Е-172');
  pressure:array[1..16] of real=(5,7,5,10,5,8.5,7.5,4.5,4,6,6,4.5,3,5,4,5);
implementation

{$R *.dfm}



procedure TForm1.N3Click(Sender: TObject);
var a:integer;
b:integer;
begin
for b:=1 to 16 do
label2.Caption:=label2.caption+FloatToStr(pressure[b])+#13;
for a:=1 to 16 do
label1.Caption:=label1.caption+shifr[a]+#13;
max1.Enabled:=true;
end;

procedure TForm1.N2Click(Sender: TObject);
begin
close;
end;

procedure TForm1.max1Click(Sender: TObject);
begin
max:=pressure[1];   n:=1;
for i:= 2 to 16 do
if max<pressure[i] then
begin
max:=pressure[i];   n:=i;
end;
label4.Caption:='Максимальный перепад давления:' +FloatToStr(max);
end;

procedure TForm1.N51Click(Sender: TObject);
begin
//не знаю, что сюда писать
end;

end.
Ответить с цитированием