Advertisement
AntoSVK

Listbox - hviezdy, gen, cistenie

Oct 22nd, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.12 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Edit1: TEdit;
  12.     Button1: TButton;
  13.     ListBox1: TListBox;
  14.     Button2: TButton;
  15.     Button3: TButton;
  16.     procedure Button3Click(Sender: TObject);
  17.     procedure Button2Click(Sender: TObject);
  18.     procedure Button1Click(Sender: TObject);
  19.     procedure hviezdy;
  20.   private
  21.     { Private declarations }
  22.   public
  23.     { Public declarations }
  24.   end;
  25.  
  26. var
  27.   Form1: TForm1;
  28.  
  29. implementation
  30.  
  31. {$R *.dfm}
  32.  
  33. procedure TForm1.Button2Click(Sender: TObject);
  34. begin
  35. Edit1.Text:='';
  36. Listbox1.Items.Clear;
  37. end;
  38.  
  39. procedure TForm1.Button3Click(Sender: TObject);
  40. var
  41. i:integer;
  42. begin
  43. randomize;
  44. for i := 1 to 10 do
  45.   begin
  46.     Listbox1.Items.Add(IntToStr(random(100)+1));
  47.   end;
  48.  
  49. end;
  50.  
  51. procedure TForm1.hviezdy;
  52. var
  53. i:integer;
  54. riadok:string;
  55. begin
  56. riadok:='';
  57. for i := 1 to StrToInt(Edit1.Text) do
  58. begin
  59.   riadok:=riadok+'*';
  60.   Listbox1.Items.Add(riadok);
  61. end;
  62. end;
  63.  
  64. procedure TForm1.Button1Click(Sender: TObject);
  65. begin
  66. hviezdy;
  67. end;
  68.  
  69. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement