25 | Interface | | 27 | 28 | | | Then begin | | 34 |

© um.co.ua -

Interface

  1. Interface

Uses

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

Dialogs, StdCtrls, ExtCtrls;

Type

TForm1 = class (TForm)

Edit1: TEdit;

Edit2: TEdit;

Button1: TButton;

Button2: TButton;

Button3: TButton;

Button4: TButton;

Image1: TImage;

Image2: TImage;

Label1: TLabel;

Label2: TLabel;

procedure FormCreate (Sender: TObject);

procedure Button2Click (Sender: TObject);

procedure Button1Click (Sender: TObject);

procedure Button3Click (Sender: TObject);

procedure Button4Click (Sender: TObject);

Private

{Private declarations}

Public

{Public declarations}

end;

Var

Form1: TForm1;

Implementation

{$ R * .dfm}

procedureTForm1.FormCreate (Sender: TObject);

Begin

Edit1.Text: = '';

Edit2.Text: = '';

Image1.Canvas.Pen.Color: = clRed;

Image1.Canvas.Brush.Color: = clWhite;

Image1.Canvas.Rectangle (10,1,23,360);

Image2.Canvas.Pen.Color: = clBlue;

Image2.Canvas.Brush.Color: = clWhite;

Image2.Canvas.Rectangle (10,1,23,360);

end;

procedureTForm1.Button2Click (Sender: TObject);

vara, b, c: real;

Begin

a: = StrToFloat (Edit1.Text);

if(A> 0) or(A <100) thenb: = 1.8 * a + 32;

ifa> 100 thenb: = 212;

ifa <0 thenb: = 32;

Edit2.Text: = FloatToStr (b);

Image1.Canvas.Pen.Color: = clRed;

Image1.Canvas.Brush.Color: = clWhite;

Image1.Canvas.Rectangle (10,1,23,360);

Image1.Canvas.Pen.Color: = clRed;

Image1.Canvas.Brush.Color: = clRed;

Image1.Canvas.Rectangle (10, round (360-a), 23,360);

Image2.Canvas.Pen.Color: = clBlue;

Image2.Canvas.Brush.Color: = clWhite;

Image2.Canvas.Rectangle (10,1,23,360);

Image2.Canvas.Pen.Color: = clBlue;

Image2.Canvas.Brush.Color: = clBlue;

Image2.Canvas.Rectangle (10, round (360-b), 23,360);

end;

procedureTForm1.Button1Click (Sender: TObject);

vara, c, d: real;

Begin

c: = StrToFloat (Edit2.Text);

if(C> 32) or(C <212) thend: = (c - 32) /1.8;

ifc <32 thend: = 0;

ifc> 212 thend: = 100;

Edit1.Text: = FloatToStr (d);

Image2.Canvas.Pen.Color: = clBlue;

Image2.Canvas.Brush.Color: = clWhite;

Image2.Canvas.Rectangle (10,1,23,360);

Image2.Canvas.Pen.Color: = clBlue;

Image2.Canvas.Brush.Color: = clBlue;

Image2.Canvas.Rectangle (10, round (360-c), 23,360);

Image1.Canvas.Pen.Color: = clRed;

Image1.Canvas.Brush.Color: = clWhite;

Image1.Canvas.Rectangle (10,1,23,360);

Image1.Canvas.Pen.Color: = clRed;

Image1.Canvas.Brush.Color: = clRed;

Image1.Canvas.Rectangle (10, round (360-d), 23,360);

end;

procedureTForm1.Button3Click (Sender: TObject);

Begin

Edit1.Text: = '';

Edit2.Text: = '';

Image1.Canvas.Pen.Color: = clRed;

Image1.Canvas.Brush.Color: = clWhite;

Image1.Canvas.Rectangle (10,1,23,360);

Image2.Canvas.Pen.Color: = clBlue;

Image2.Canvas.Brush.Color: = clWhite;

Image2.Canvas.Rectangle (10,1,23,360);

end;

procedureTForm1.Button4Click (Sender: TObject);

Begin

Close;

end;

procedureTForm1.Edit1Enter (Sender: TObject);

Begin

Button2.Visible: = true;

Button1.Visible: = False;

end;

procedureTForm1.Edit2Enter (Sender: TObject);

Begin

Button1.Visible: = True;

Button2.Visible: = False;

end;

end.



32 |