如何在控制台上写下来? [英] How to write down to up at console?

查看:71
本文介绍了如何在控制台上写下来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我创建了一个将要下雪的简单应用程序:),但是正如您在控制台上所知道的那样,当它将点写为下雪时,它会转到下一行,最后下雪是上升而不是下降,我该怎么做它像雪一样(向上或向下)?
谢谢.

Hi,
I''v created a simple app that is going to be snow :) but as you know at console, when it writes dots as snow , it goes to next line and finally snow goes up instead of down, what should I do to make it right like snow (up to down)??
Thanks.

推荐答案

您需要使用转义码在屏幕上的特定位置写入字符(请参见
You need to use the escape codes to write characters at specific locations in the screen (see here[^]). But I am not sure how many of these are supported in the Windows command prompt window.


我认为您需要在写入每个字符之前使用Console.CursorTop和CursorLeft设置光标位置.不过,您每次都必须重新绘制整个屏幕.

这种类型的应用程序在现实世界中很少有用,因此,尽管控制台应用程序通常是一个很好的学习工具,但比起在控制台中如何制作图形效果,还有更好的方法来度过您的时间.
I think you need to use Console.CursorTop and CursorLeft to set the cursor position before writing each character. You will have to redraw the whole screen each time, though.

This type of application is rarely useful in the real world, so while console applications in general are a good learning device, there are better ways to spend your time than working out how to do graphical effects in the console.


您还可以在边界区域内使用随机位置. :)
You can also use random location within the boundary area. :)


这篇关于如何在控制台上写下来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆