Как приложить исходники?
Исходный код модуля Uni1:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, Spin;
type
{ TForm1 }
TForm1 = class(TForm) FloatSpinEdit1: TFloatSpinEdit; FloatSpinEdit2: TFloatSpinEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; procedure FloatSpinEdit1Change(Sender: TObject); procedure FloatSpinEdit2Change(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Label1Click(Sender: TObject); private { private declarations } public { public declarations } end;
var Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure calcsquare;begin Form1.Label3.Caption:='Площадь кольца '+FloatToStr(3.141592*Form1.FloatSpinEdit1.Value*Form1.FloatSpinEdit1.Value-3.141592*Form1.FloatSpinEdit2.Value*Form1.FloatSpinEdit2.Value);end;
procedure checkvalues;begin if (Form1.FloatSpinEdit2.Value>Form1.FloatSpinEdit1.Value) then begin Showmessage('Внешний радиус не может быть меньше внутреннего'); Form1.FloatSpinEdit2.Value:=Form1.FloatSpinEdit1.Value; end else begin calcsquare; end;end;
procedure TForm1.Label1Click(Sender: TObject);begin
end;
procedure TForm1.FloatSpinEdit1Change(Sender: TObject);begin checkvalues;end;
procedure TForm1.FloatSpinEdit2Change(Sender: TObject);begin checkvalues;end;
procedure TForm1.FormCreate(Sender: TObject);begin
end;
end.
Исходный код формы Form1
object Form1: TForm1 Left = 357 Height = 180 Top = 212 Width = 311 Caption = 'Расчет площади кольца' ClientHeight = 180 ClientWidth = 311 LCLVersion = '1.0.12.0' object Label1: TLabel Left = 37 Height = 16 Top = 16 Width = 94 Caption = 'Внешний радиус' ParentColor = False OnClick = Label1Click end object Label2: TLabel Left = 39 Height = 16 Top = 82 Width = 108 Caption = 'Внутренний радиус' ParentColor = False end object FloatSpinEdit1: TFloatSpinEdit Left = 40 Height = 23 Top = 32 Width = 234 Increment = 1 MaxValue = 100 MinValue = 0 OnChange = FloatSpinEdit1Change TabOrder = 0 Value = 0 end object FloatSpinEdit2: TFloatSpinEdit Left = 40 Height = 23 Top = 102 Width = 234 Increment = 1 MaxValue = 100 MinValue = 0 OnChange = FloatSpinEdit2Change TabOrder = 1 Value = 0 end object Label3: TLabel Left = 40 Height = 16 Top = 147 Width = 7 Caption = 'S' ParentColor = False endend