Fórum Dúvida componente Shape, Delhpi 10 #576955
14/03/2017
0
procedure TFPesquisa.Timer1Timer(Sender: TObject);
var RandomValue, x: LongWord;
begin
try
Randomize;
RandomValue := Random(16) + 1;
x := Random(1000) + 500;
if RandomValue = 1 then
begin
shape1.shape:= strectangle;
shape1.brush.color:= clred;
timer1.interval := x;
if Dm.Cd_Escolha = 5 then
start := GetTickCount;
end;
if RandomValue = 2 then
begin
shape1.shape:= strectangle;
shape1.brush.color:= clblue;
timer1.interval := x;
if Dm.Cd_Escolha = 6 then
start := GetTickCount;
end;
if RandomValue = 3 then
begin
shape1.shape:= strectangle;
shape1.brush.color:= clgreen;
timer1.interval := x;
if Dm.Cd_Escolha = 8 then
start := GetTickCount;
end;
if RandomValue = 4 then
begin
shape1.shape:= strectangle;
shape1.brush.color:= clyellow;
timer1.interval := x;
if Dm.Cd_Escolha = 7 then
start := GetTickCount;
end;
if RandomValue = 5 then
begin
shape1.shape:= stSquare;
shape1.brush.color:= clRed;
timer1.interval := x;
if Dm.Cd_Escolha = 1 then
start := GetTickCount;
end;
if RandomValue = 6 then
begin
shape1.shape:= stSquare;
shape1.brush.color:= clBlue;
timer1.interval := x;
if Dm.Cd_Escolha = 2 then
start := GetTickCount;
end;
if RandomValue = 7 then
begin
shape1.shape:= stSquare;
shape1.brush.color:= clYellow;
timer1.interval := x;
if Dm.Cd_Escolha = 3 then
start := GetTickCount;
end;
if RandomValue = 8 then
begin
shape1.shape:= stSquare;
shape1.brush.color:= clGreen;
timer1.interval := x;
if Dm.Cd_Escolha = 4 then
start := GetTickCount;
end;
if RandomValue = 9 then
begin
shape1.shape:= stCircle;
shape1.brush.color:= clRed;
timer1.interval := x;
if Dm.Cd_Escolha = 9 then
start := GetTickCount;
end;
if RandomValue = 10 then
begin
shape1.shape:= stCircle;
shape1.brush.color:= clBlue;
timer1.interval := x;
if Dm.Cd_Escolha = 10 then
start := GetTickCount;
end;
if RandomValue = 11 then
begin
shape1.shape:= stCircle;
shape1.brush.color:= clYellow;
timer1.interval := x;
if Dm.Cd_Escolha = 11 then
start := GetTickCount;
end;
if RandomValue = 12 then
begin
shape1.shape:= stCircle;
shape1.brush.color:= clGreen;
timer1.interval := x;
if Dm.Cd_Escolha = 12 then
start := GetTickCount;
end;
if RandomValue = 13 then
begin
shape1.shape:= stEllipse;
shape1.brush.color:= clRed;
timer1.interval := x;
if Dm.Cd_Escolha = 13 then
start := GetTickCount;
end;
if RandomValue = 14 then
begin
shape1.shape:= stEllipse;
shape1.brush.color:= clBlue;
timer1.interval := x;
if Dm.Cd_Escolha = 14 then
start := GetTickCount;
end;
if RandomValue = 15 then
begin
shape1.shape:= stEllipse;
shape1.brush.color:= clYellow;
timer1.interval := x;
if Dm.Cd_Escolha = 15 then
start := GetTickCount;
end;
if RandomValue = 16 then
begin
shape1.visible := true;
shape1.shape:= stEllipse;
shape1.brush.color:= clGreen;
timer1.interval := x;
if Dm.Cd_Escolha = 16 then
start := GetTickCount;
end;
Application.ProcessMessages;
except
end;
end;
Leonardo
Curtir tópico
+ 0Posts
14/03/2017
Alberto
Exemplo
Shape1 := TShape.Create(Self)
Shape1.Brush.color := clRed;
.
Faz o que tem que fazer e depois destroi
.
Shape1.Destroy
.
Nesse momento ele some da tela.
Gostei + 0
15/03/2017
Leonardo
ex: [url]https://uploaddeimagens.com.br/imagens/exemplo-png--64[/url]
Gostei + 0
15/03/2017
Alberto
è só fazer o mesmo com as outras propriedades
.
shape1.width := 100;
shape1.height := 100;
shape1.left := (self.width-shape1.width) div 2;
shape1.top := (self.height-shape1.height) div 2;
.
e assim por diante
Gostei + 0
15/03/2017
Leonardo
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)