BVB Source Codes

Children's mathematical arithmetic software in Delphi source code Show Untmath.pas Source code

Return Download Children's mathematical arithmetic software in Delphi source code: download Untmath.pas Source code - Download Children's mathematical arithmetic software in Delphi source code Source code - Type:.pas
  1. unit Untmath;
  2. interface
  3. uses
  4.   Windows, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, ExtCtrls, Buttons,MMSystem, Menus, spin, jpeg ;
  6. type
  7.   TFrmmath = class(TForm)
  8.     SpinEdit1: TSpinEdit;
  9.     pnl1: TPanel;
  10.     pnl2: TPanel;
  11.     lbl1: TLabel;
  12.     lbl2: TLabel;
  13.     pb1: TPaintBox;
  14.     lbl3: TLabel;
  15.     lbl4: TLabel;
  16.     lbl5: TLabel;
  17.     pb2: TPaintBox;
  18.     pnl3: TPanel;
  19.     rg3: TRadioGroup;
  20.     pnl4: TPanel;
  21.     btn2: TSpeedButton;
  22.     img1: TImage;
  23.     pm1: TPopupMenu;
  24.     N1: TMenuItem;
  25.     N2: TMenuItem;
  26.     N3: TMenuItem;
  27.     Image1: TImage;
  28.     GroupBox1: TGroupBox;
  29.     Label1: TLabel;
  30.     Label2: TLabel;
  31.     RadioButton1: TRadioButton;
  32.     RadioButton2: TRadioButton;
  33.     RadioButton3: TRadioButton;
  34.     RadioButton4: TRadioButton;
  35.     Bevel1: TBevel;
  36.     procedure btn2Click(Sender: TObject);
  37.     procedure FormCreate(Sender: TObject);
  38.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  39.     procedure rg3Click(Sender: TObject);
  40.     procedure N1Click(Sender: TObject);
  41.     procedure N3Click(Sender: TObject);
  42.     procedure RadioButton1Click(Sender: TObject);
  43.   private
  44.     procedure getrandomds;
  45.     procedure getrandom_adding(k:Integer;var i,j:Integer);
  46.     procedure getrandom_subtract(k:Integer;var i,j:Integer);
  47.     procedure getrandom_multiply(k:Integer;var i,j:Integer);
  48.     procedure getrandom_divide(k:Integer;var i,j:Integer);
  49.     { Private declarations }
  50.   public
  51.     { Public declarations }
  52.   end;
  53. var
  54.   Frmmath: TFrmmath;
  55.   ds:Integer;
  56.   yesbmp,nobmp,lightbmp:TBitmap ;
  57.   rightsound,wrongsound:pchar;
  58. implementation
  59.     uses Untfun ;
  60. {$R *.dfm}
  61. {$R windowsxp.res}
  62. {$R myres.RES}
  63. procedure TFrmmath.getrandomds;
  64. var
  65.   i,j,k:Integer ;
  66.   s,s1:string;
  67. begin
  68.   Randomize;
  69.   k:=random(6);
  70.   rg3.Items.Strings[k]:=IntToStr(ds);
  71.   s:='#'+IntToStr(ds)+'#';
  72.   for i:=0 to k-1 do
  73.   begin
  74.     repeat
  75.       Randomize;
  76.       j:=1+Random(ds+6);
  77.       s1:='#'+IntToStr(j)+'#';
  78.     until Pos(s1,s)=0 ;
  79.      rg3.Items.Strings[i]:=IntToStr(j);
  80.      s:=s+s1;
  81.   end;
  82.   for i:=k+1 to 5 do
  83.   begin
  84.     repeat
  85.       Randomize ;
  86.       j:=1+Random(ds+6);
  87.       s1:='#'+IntToStr(j)+'#';
  88.     until Pos(s1,s)=0;
  89.      rg3.Items.Strings[i]:=IntToStr(j);
  90.      s:=s+s1;
  91.   end;
  92. end;
  93. procedure TFrmmath.getrandom_adding(k:Integer;var i,j:Integer);
  94. begin
  95.   Randomize;
  96.   i:=1+random(k);
  97.   j:=1+random(k);
  98. end;
  99. procedure TFrmmath.getrandom_divide(k:Integer;var i, j: Integer);
  100. begin
  101.   repeat
  102.     Randomize;
  103.     i:=1+random(k);
  104.     j:=1+random(k);
  105.   until (i mod j=0) and (i<>j);
  106. end;
  107. procedure TFrmmath.getrandom_multiply(k:Integer;var i, j: Integer);
  108. begin
  109.   Randomize;
  110.   i:=1+random(k);
  111.   j:=1+random(k);
  112. end;
  113. procedure TFrmmath.getrandom_subtract(k:Integer;var i, j: Integer);
  114. begin
  115.   repeat
  116.     Randomize;
  117.     i:=1+random(k);
  118.     j:=1+random(k);
  119.    until i>=j;
  120. end;
  121. procedure TFrmmath.btn2Click(Sender: TObject);
  122. var
  123.   i,j,k,p:Integer ;
  124. begin
  125.   Image1.Picture :=nil ;
  126.   K:=SpinEdit1.Value;
  127.   if RadioButton1.Checked then
  128.   begin
  129.     getrandom_adding(k,i,j);
  130.     ds:=i+j;
  131.   end;
  132.   if RadioButton2.Checked then
  133.   begin
  134.     getrandom_subtract(k,i,j);  //
  135.     ds:=i-j;
  136.   end;
  137.   if RadioButton3.Checked then
  138.   begin
  139.     getrandom_multiply(k,i,j);
  140.     ds:=i*j;
  141.   end;
  142.   if RadioButton4.Checked then
  143.   begin
  144.     getrandom_divide(k,i,j);
  145.     ds:=i div j;
  146.   end;
  147.   pb1.Repaint ;
  148.   for p:=1 to i do
  149.   begin
  150.     if p<11 then
  151.       pb1.Canvas.Draw(p*34,0,lightbmp)
  152.     else
  153.       pb1.Canvas.Draw((p-10)*34,34,lightbmp);
  154.   end;
  155.   pb2.Repaint ;
  156.   for p:=1 to j do
  157.   begin
  158.     if p<11 then
  159.     pb2.Canvas.Draw(p*34,0,lightbmp)
  160.     else
  161.     pb2.Canvas.Draw((p-10)*34,34,lightbmp);
  162.   end;  
  163.  lbl1.Caption :=IntToStr(i);
  164.  lbl3.Caption :=IntToStr(j);
  165.  lbl5.Caption :='?';
  166.  rg3.ItemIndex :=-1;
  167.  getrandomds ;
  168. end;
  169. procedure TFrmmath.FormCreate(Sender: TObject);
  170. var
  171.   stream:TStream;
  172.   hResInfo,hres : THandle;
  173. begin
  174.   yesbmp:=TBitmap.Create ;
  175.   nobmp :=TBitmap.Create ;
  176.   lightbmp :=TBitmap.Create ;
  177.   yesbmp.LoadFromResourceName(HInstance,'yes') ;
  178.   nobmp.LoadFromResourceName(HInstance,'no') ;
  179.   stream :=TResourceStream .Create(HInstance,'light','bmp');
  180.   lightbmp.LoadFromStream(stream);
  181.   Stream.Free ;
  182.   hResInfo:=FindResource(HInstance, 'right', 'WAVE');
  183.   hRes := LoadResource(HInstance,hResInfo);
  184.   if hRes > 32 then
  185.   begin
  186.   rightSound:=LockResource(hRes);
  187.   end;
  188.   hResInfo := FindResource(HInstance, 'wrong', 'WAVE');
  189.   hRes := LoadResource(HInstance,hResInfo);
  190.   if hRes > 32 then
  191.   begin
  192.   wrongSound:=LockResource(hRes);
  193.   end;
  194. end;
  195. procedure TFrmmath.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  196. begin
  197.   yesbmp.Free;
  198.   nobmp .Free;
  199.   lightbmp .Free;
  200. end;
  201. procedure TFrmmath.rg3Click(Sender: TObject);
  202. var
  203.   s:string;
  204. begin
  205.   s:=rg3.Items.Strings[rg3.ItemIndex];
  206.   lbl5.Caption :=s;
  207.   if StrToInt(s)=ds then
  208.   begin
  209.     Image1.Canvas.Draw(0,0,yesbmp);
  210.     sndplaysound(rightsound,snd_async or snd_Memory);
  211.   end
  212.   else
  213.   begin
  214.     Image1.Canvas.Draw(0,0,nobmp);
  215.     sndplaysound(wrongsound ,snd_async or snd_Memory);
  216.   END;
  217. end;
  218. procedure TFrmmath.N1Click(Sender: TObject);
  219. begin
  220.   if (Sender as TMenuItem).Checked =False then
  221.   begin
  222.     setwindowpos(handle,hwnd_topmost,left,top,width,height,swp_showwindow);
  223.     (Sender as TMenuItem).Checked :=True;
  224.   end
  225.   else
  226.   begin
  227.     setwindowpos(handle,hwnd_notopmost,left,top,width,height,swp_showwindow);
  228.     (Sender as TMenuItem).Checked :=False ;
  229.   end;
  230. end;
  231. procedure TFrmmath.N3Click(Sender: TObject);
  232. begin
  233.   creatdesktoplink('少儿数学软件(张永生完善版)');
  234. end;
  235. procedure TFrmmath.RadioButton1Click(Sender: TObject);
  236. begin
  237.   case (Sender as TRadioButton).Tag of
  238.   0: lbl2.Caption :='+';
  239.   1: lbl2.Caption :='-';
  240.   2: lbl2.Caption :='×';
  241.   3: lbl2.Caption :='÷';
  242.   end;
  243. end;
  244.  
  245. end.
  246.  
  247.  
  248.  
downloadUntmath.pas Source code - Download Children's mathematical arithmetic software in Delphi source code Source code
Related Source Codes/Software:
Delphi screen touch cash register system source program - From the perspective of directory structure, this ... 2012-02-18
Delphi examples of using the Image control to display and draw text - The Delphi examples through the use of an Image co... 2012-02-18
Delphi kanji literacy software full version - Delphi pupils ' Chinese character recognition soft... 2012-02-18
Delphi uses the MMS protocol to download streaming media file - Delphi uses the MMS protocol to download streaming... 2012-02-18
Delphi implements a simple P2P chat program - This simple P2P chat software used to simple Serve... 2012-02-18
Image selection/editing plug-in v2.0 Delphi Edition - This is a DELPHI graphics you want to use a plugin... 2012-02-18
Magnificent Delphi implementation interface game Lander - Delphi complete source of legends of the game land... 2012-02-18
Delphi source code enterprise generic invoicing system - A common IT industry enters sells saves management... 2012-02-18
Stamp making software Delphi source code - The DELPHI software is very clever, you can achiev... 2012-02-18
Features of Delphi good teaching management system - A written in DLEPHI language teaching management ... 2012-02-18
Delphi car rental company business management system - A car rental company's business management systems... 2012-02-18
Delphi major revision of the human resources management system source code - RedHR owned a large OFFICE of human resources mana... 2012-02-18
DELPHI pawn industry management system source code - Pawn shop of an integrated business management sys... 2012-02-18
Cool interface Delphi chat software source code - Interface is really cool? This is a small LAN chat... 2012-02-18
Delphi shield Ctrl+Alt+Del reqijian method - Real shielding theory of Delphi is this: using a r... 2012-02-18
Classic RPG games with Delphi source code - The actual and Diablo game or scene is similar in ... 2012-02-18
35 Delphi7 Indy instance package - Application example demonstrates a lot of Indy Dem... 2012-02-18
Delphi transportation company business management system - A Delphi transportation company business managemen... 2012-02-18
Using Delphi to achieve control of the camera - This procedure describes how to use DELPHI AVICAP3... 2012-02-18
Cell of the report component for Delphi example source program - UFIDA table company developed a report component, ... 2012-02-18

 Back to top