this slowpoke moves

Color to Beep

private
    { Private declarations }

var
  Form1: TForm1;
  Lab: Array[1..65] of TLabel;
  
//

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Byte;
begin
  Randomize;
  for i:= 1 to 65 do
   begin
  Lab[i]:= TLabel.Create(Self);
  Lab[i].Parent := Self;
  Lab[i].Left := 8 + 11*(i-1);
  Lab[i].Top := 48;
  Lab[i].Constraints.MinWidth:= 10;
  Lab[i].Constraints.MaxWidth:= 10;
  Lab[i].Constraints.MinHeight:= 50;
  Lab[i].Color:= Random(16777216);
  Lab[i].OnMouseEnter:= BarClick;
   end; { i loop }
end;

procedure TForm1.BarClick(Sender: TObject);
begin
  Application.ProcessMessages;

  with Sender as TLabel do
     Windows.Beep(440 + (Color div 3500), 100);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Byte;
begin
  for i:= 1 to 65 do
      Lab[i].Color:= Random(16777216);
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate