RSS    

   Ðåôåðàò: Ðàçðàáîòêà èíòåðàêòèâíîé ñðåäû îáó÷åíèÿ ðàáîòå

r:trect;

temp:tfont;

begin

{  frmlesson.pic1.left:=0;}

  frmlesson.Canvas.TextOut(3,3,'');

  np:=1;

  r.Left:=0;

  r.Top:=0;

  r.Right:=frmlesson.Width;

  r.Bottom:=frmlesson.Height-80;

  frmlesson.Canvas.FillRect(r);

  if not nopaint then begin

   npic:=@frmlesson.pic1;

   frmlesson.pic1.hide;

   frmlesson.pic2.hide;

   frmlesson.pic3.hide

  end;

  frmlesson.canvas.fillrect(r);

  i:=1;

  while i<sp-1 do begin

           s:=strpage[i];

           inc(i);

           if s='/:question' then begin

                temp:=frmlesson.Canvas.Font;

                frmlesson.Canvas.Font.Color:=clred;

                frmlesson.Canvas.pen.Color:=clred;

                r.Top:=texty;

                r.Left:=3;

                r.Right:=frmlesson.Width-10;

                r.Bottom:=texty+38;

                frmlesson.Canvas.Rectangle(r);

                frmlesson.cmdyes.top:=texty+6;

                frmlesson.cmdYes.Left:=frmlesson.width-170;

                frmlesson.cmdno.top:=texty+6;

                frmlesson.cmdno.Left:=frmlesson.width-90;

                frmlesson.cmdYes.Show;

                frmlesson.cmdno.show;

                frmlesson.Canvas.Font:=temp;

                s:=strpage[i];

                frmlesson.Canvas.TextOut(5,texty+3,s);

                ap:=strtoint(strpage[i+1]);

                inc(texty,40);

                inc(i,2)

           end else

           if s='/:picture' then begin

              inc(i,3);

              if nopaint then goto 1;

              x:=strtoint(strpage[i-3]);

              y:=strtoint(strpage[i-2]);

              s:=strpage[i-1];

              npic^.Enabled:=true;

              npic^.Picture.LoadFromFile(s);

              npic^.left:=x;

              npic^.top:=y;

              npic^.visible:=true;

              if np=1 then begin

                np:=2;

                npic:=@frmlesson.pic2;

              end else npic:=@frmlesson.pic3;

           1:

           end else

           if s='/:size' then begin

                n:=strtoint(strpage[i]);

                inc(i);

                frmlesson.canvas.Font.Size:=n

           end else

           if s='/:font' then begin

                s:=strpage[i];

                inc(i);

                frmlesson.canvas.Font.Name:=s

           end else

           if s='/:style' then begin

                n:=strtoint(strpage[i]);

                inc(i);

                case n of

                1:w:=[];

                2:w:=[fsbold];

                4:w:=[fsitalic];

                3:w:=[fsunderline];

                5:w:=[fsstrikeout];

                end;

                frmlesson.canvas.Font.Style:=w

           end else

           if s='/:color' then begin

                s:=strpage[i];

                inc(i);

                if s='black' then q:=clblack;

                if s='red' then q:=clred;

                if s='blue' then q:=clblue;

                if s='green' then q:=clgreen;

                if s='gray' then q:=clgray;

                if s='yellow' then q:=clyellow;

                frmlesson.canvas.font.Color:=q

           end else

           if s='/:newpage' then exit else begin

              frmlesson.Canvas.TextOut(2,texty,s);

              inc(texty,frmlesson.Canvas.Font.Size+10)

           end;

     end

end;

procedure TfrmLesson.FormClose(Sender: TObject; var Action: TCloseAction);

begin

   closefile(f);

   if nq>0 then frmresult.show else frmrun.Show

end;

procedure TfrmLesson.SpeedButton3Click(Sender: TObject);

begin

     frmlesson.hide;

     frmresult.show

end;

procedure TfrmLesson.FormPaint(Sender: TObject);

begin

        texty:=2;

        if first then begin

                first:=false;

                fontemp:=frmlesson.canvas.font;

                drawpage

        end else begin

         nopaint:=true;

         drawpage;

         nopaint:=false

        end

end;

procedure TfrmLesson.FormShow(Sender: TObject);

var s,name:string;

begin

     nq:=0;

     first:=true;

     nopaint:=true;

     assignfile(f,lessonname);

     reset(f);

     while not eof(f) do begin

      readln(f,s);

      if s='/:question' then inc(nq)

     end;

     closefile(f);

     reset(f);

     readln(f,name);

     frmlesson.Caption:=name;

     textY:=2;

     loadpage;

     frmlesson.Canvas.textout(20,20,'');

end;

procedure TfrmLesson.FormDeactivate(Sender: TObject);

begin

        nopaint:=true

end;

procedure TfrmLesson.Timer1Timer(Sender: TObject);

var q:tcolor;

x,y:integer;

begin

{    if not frmlesson.Visible then exit;

    x:=random(frmlesson.Width);

    y:=random(frmlesson.Height);

    if (x in [pic1.Left..pic1.Left+pic1.Width]) or (y in [pic1.Top..pic1.Top+pic1.Height]) then exit;

    q:=frmlesson.canvas.pixels[x,y];

    if q<>clwhite then begin

        nopaint:=true;

        texty:=1;

        drawpage

        end;

frmlesson.canvas.pixels[x,y]:=clred;}

end;

procedure TfrmLesson.FormCreate(Sender: TObject);

begin

        npq:=0;

        ap:=1;

        pp:=0;

        numpage:=1;

end;

procedure TfrmLesson.cmdYesClick(Sender: TObject);

begin

        if ap=1 then inc(npq);

        frmlesson.cmdYes.enabled:=false;

        frmlesson.cmdno.enabled:=false;

end;

procedure TfrmLesson.cmdNoClick(Sender: TObject);

begin

        if ap=2 then inc(npq);

        frmlesson.cmdYes.enabled:=false;

        frmlesson.cmdno.enabled:=false;

end;

procedure TfrmLesson.SpeedButton2Click(Sender: TObject);

begin

        canvas.Rectangle(0,0,width,height);

        pic1.Hide;

        pic2.Hide;

        pic3.Hide;

        frmlesson.Repaint;

{        pic1.show;

        pic1.hide;            }

        inc(numpage);

        if not speedbutton1.enabled then speedbutton1.Enabled:=true;

        frmlesson.cmdYes.hide;

        frmlesson.cmdno.hide;

{        frmlesson.pic1.hide;}

        frmlesson.pic2.hide;

        frmlesson.pic3.hide;

        texty:=1;

        sp:=0;

        loadpage;

        drawpage;

        if eof(f) then speedbutton2.Enabled:=false

end;

procedure TfrmLesson.SpeedButton1Click(Sender: TObject);

var i:byte;

q:integer;

s:string[100];

begin

        pic1.Hide;

        pic2.Hide;

        pic3.Hide;

        frmlesson.Repaint;

        dec(numpage);

        if not speedbutton2.enabled then speedbutton2.Enabled:=true;

        closefile(f);

        reset(f);

        canvas.Font:=pagefonts[numpage];

        if numpage=1 then begin

          readln(f);

          speedbutton1.Enabled:=false

        end else begin

          i:=0;

          while i<numpage-1 do begin

            readln(f,s);

            if s='/:color' then begin

               readln(f,s);

               if s='black' then q:=clblack;

               if s='red' then q:=clred;

               if s='blue' then q:=clblue;

               if s='green' then q:=clgreen;

               if s='gray' then q:=clgray;

               if s='yellow' then q:=clyellow;

               frmlesson.canvas.font.Color:=q

            end;

            if s='/:name' then begin

               readln(f,s);

               canvas.Font.Name:=s

            end;

            if s='/:size' then begin

               readln(f,q);

               canvas.Font.Size:=q

            end;

            if s='/:newpage' then inc(i)

          end

        end;

{        for i:=1 to pages[pp-2] do readln(f);

        for i:=1 to pp do pages[pp]:=0;

        dec(pp,2);

        if pp=0 then begin

                readln(f);

                frmlesson.canvas.Font:=fontemp;

        end;}

        frmlesson.cmdYes.hide;

        frmlesson.cmdno.hide;

        frmlesson.pic1.hide;

        frmlesson.pic2.hide;

        frmlesson.pic3.hide;

        texty:=1;

        sp:=0;

        loadpage;

        if pp=1 then speedbutton1.enabled:=false;

        drawpage;

end;

procedure TfrmLesson.FormActivate(Sender: TObject);

begin

   formcreate(sender);

end;

end.

unit resfrm;

interface

uses

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

  StdCtrls, Grids;

type

  TfrmResult = class(TForm)

    StringGrid1: TStringGrid;

    Button1: TButton;

    procedure FormActivate(Sender: TObject);

    procedure Button1Click(Sender: TObject);

    procedure FormClose(Sender: TObject; var Action: TCloseAction);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

var

  frmResult: TfrmResult;

implementation

uses runfrm, lessonfrm;

{$R *.DFM}

procedure TfrmResult.FormActivate(Sender: TObject);

begin

   with stringgrid1 do begin

      colwidths[0]:=150;

      cells[1,0]:='Êîëè÷åñòâî';

      cells[0,1]:='Âîïðîñîâ';

      cells[0,2]:='Ïðàâèëüíûõ îòâåòîâ';

      cells[1,1]:=inttostr(frmlesson.nq);

      cells[1,2]:=inttostr(frmlesson.npq);

   end

end;

procedure TfrmResult.Button1Click(Sender: TObject);

begin

   frmresult.Hide;

   frmrun.Show

end;

procedure TfrmResult.FormClose(Sender: TObject; var Action: TCloseAction);

begin

   action:=cahide;

   frmrun.Show

end;

end.


Ñòðàíèöû: 1, 2, 3, 4


Íîâîñòè


Áûñòðûé ïîèñê

Ãðóïïà âÊîíòàêòå: íîâîñòè

Ïîêà íåò

Íîâîñòè â Twitter è Facebook

                   

Íîâîñòè

Îáðàòíàÿ ñâÿçü

Ïîèñê
Îáðàòíàÿ ñâÿçü
Ðåêëàìà è ðàçìåùåíèå ñòàòåé íà ñàéòå
© 2010.