英文:
How to fill the graphic window?
问题
如何将一系列金字塔扩展到整个窗口?我在最后的块中输入了x
和y
的值,但这对任何事情都没有影响。
英文:
uses GraphABC;
var
x, y: integer;
procedure kv(x, y: integer; color: system.Drawing.Color);
begin
Rectangle(x, y, x + 20, y - 50);
FloodFill(x + 10, y - 10, color);
end;
procedure radpiramid;
begin
x := 80;
while x < 640 do
begin
SetPenColor(clBlack);
kv(x - 40, 50, clGreen);
y := 100;
for var i := 1 to 3 do
kv(x - 20 * i, y, clOrange);
y := 150;
for var i := 1 to 5 do
kv(x + 40 - 20 * (i + 1), y, clRed);
x := x + 105;
end
end;
begin
while y <= windowHeight do
begin
radpiramid;
end;
end.
How to extend a series of pyramids to the entire window? I enter the values of x
and y
in the last block, but this does not affect anything.
答案1
得分: 0
在radpiramid
和kv
过程中,您正在使用固定值的y。
procedure kv(x, y: integer; color: system.Drawing.Color);
...
Rectangle(x, y, x + 20, y - 50); <----------------
...
procedure radpiramid;
...
kv(x - 40, 50, clGreen);
y := 100; <--------------------
for var i := 1 to 3 do
kv(x - 20 * i, y, clOrange);
y := 150; <-----------------------
for var i := 1 to 5 do
kv(x + 40 - 20 * (i + 1), y, clRed);
...
必须增加y的值以使金字塔在窗口的不同高度出现。
英文:
Inside the radpiramid
procedure and kv
procedure you using a fixed value of y.
procedure kv(x, y: integer; color: system.Drawing.Color);
...
Rectangle(x, y, x + 20, y - 50); <----------------
...
procedure radpiramid;
...
kv(x - 40, 50, clGreen);
y := 100; <--------------------
for var i := 1 to 3 do
kv(x - 20 * i, y, clOrange);
y := 150; <-----------------------
for var i := 1 to 5 do
kv(x + 40 - 20 * (i + 1), y, clRed);
...
You must increase this value of y to get pyramids to appear at different heights of the window.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论