是否可以将文本固定在控制台 c# 的顶部
Is it possible to pin a text on the top of the console c#
你好,我想在 c# 的控制台顶部添加一个文本,上面写着类似(STATS:health="" Coins="",就像一个状态栏),它必须被固定(我不知道我是否使用了正确的动词)。我想对切换菜单做同样的事情(总是看到带有选项的菜单)。
谢谢。
您不能在 Windows Console Application
中固定任何内容。
我认为您尝试实现的是每次清除控制台并重绘屏幕。
举个例子:
class Program
{
static void Main(string[] args)
{
int counter = 0;
while (true)
{
counter++;
DrawScreen(counter);
Console.ReadKey();
}
}
static void DrawScreen(int turn)
{
// Clear Console
Console.Clear();
// Draw Statusbar again on the 'top'
Console.WriteLine("Current Turn: {0}", turn);
// Draw additional stuff
}
}
你好,我想在 c# 的控制台顶部添加一个文本,上面写着类似(STATS:health="" Coins="",就像一个状态栏),它必须被固定(我不知道我是否使用了正确的动词)。我想对切换菜单做同样的事情(总是看到带有选项的菜单)。
谢谢。
您不能在 Windows Console Application
中固定任何内容。
我认为您尝试实现的是每次清除控制台并重绘屏幕。
举个例子:
class Program
{
static void Main(string[] args)
{
int counter = 0;
while (true)
{
counter++;
DrawScreen(counter);
Console.ReadKey();
}
}
static void DrawScreen(int turn)
{
// Clear Console
Console.Clear();
// Draw Statusbar again on the 'top'
Console.WriteLine("Current Turn: {0}", turn);
// Draw additional stuff
}
}