您的位置:首页 > 编程语言 > C#

c# console move string

2013-11-13 18:54 429 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.Yellow;
int m = 0;
int n = 0;
Console.Write("zxl");
do
{
switch (Console.ReadKey(true).Key)
{
case ConsoleKey.UpArrow:
n = n - 1;
break;
case ConsoleKey.DownArrow:
n = n + 1;
break;
case ConsoleKey.LeftArrow:
m = m - 1;
break;
case ConsoleKey.RightArrow:
m = m + 1;
break;
}
Console.Clear();
string aa = "";
string bb = "";
for (int a = 0; a < m; a++)
{
aa += " ";
}
for (int b = 0; b < n; b++)
{
bb += "\n";
}
Console.Write(bb + aa + "zxl");
}
while (true);
}
}
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: