
01.05.2011, 18:15
|
 |
Новичок
|
|
Регистрация: 28.04.2011
Сообщения: 67
Репутация: 10
|
|
Ошибка с полем Memo =(
помогите пожалуйста исправить ошибки =(, тут самую превую выдает на 51 строке
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
LabeledEdit3: TLabeledEdit;
Memo1: TMemo;
Button1: TButton;
Image1: TImage;
procedure LabeledEdit3Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Xmin,Xmax,h,y:real;
cx,cy:real;
begin
try
Xmin:=StrToFloat(LabeledEdit1.Text);
Xmax:=StrToFloat(LabeledEdit2.Text);
h:=StrToFloat(LabeledEdit3.Text);
except
MessageDlg('неверные данные',mtError,[mbOK],0);
exit
end;
if Xmax<=Xmin then
begin
MessageDlg('Xmin>Xmax!',mtError,[mbOK],0);
exit
end;
end;
Memo1.Lines.Clear;
with Image1.Canvas do
begin
Brash.Color:=clBlue;
FillRect(Image1.ClientRect);
pen.color:=clWhite;
moveto(0,Image1.Height div 2);
lineto(Image1.Width,Image1.Height div 2);
cx:=(Xmax-Xmin)/Image1.Width;
cy:=2/Image1.Height;
if cy>cx then
cx:=cy;
moveto(0,Image1.Height div 2);
While Xmin<=Xmax do
begin
y:=sin(Xmin);
Memo1.Lines.Add('sin('+FloatToStrF(Xmin,ffFixed,10,4)+')='+FloatToStrF(y,ffFixed,10,4));
lineto(trunc(Xmin/cx),Image1.Height div 2 - trunc(Xmin/cx));
Xmin:=Xmin+h;
end;
end;
end.
|