在命令行中写大字。。。

在命令行中写字,效果如下。。

在命令行中写大字。。。_第1张图片

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Threading;

namespace
{
class Program
{
static void Main(string[] args)
{
string word = "子非牛";
Console.SetWindowSize(80, 25);
Random r = new Random();
while (true)
{
ConsoleColor cccc = (ConsoleColor)r.Next(1, 16);
Bitmap bmp = new Bitmap(80, 25);
Graphics g = Graphics.FromImage(bmp);
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush(Color.Black);
g.DrawString(word, drawFont, drawBrush, new PointF(0, 0));

Color b = Color.FromArgb(0, 0, 0, 0);
//bmp.Save("niu.bmp");
try
{
for (int x = 0; x < bmp.Height; x++)
{
for (int y = 0; y < bmp.Width; y++)
{
Color cc = bmp.GetPixel(y, x);
if (cc != b)
{
Console.BackgroundColor = cccc;
Console.Write(" ");
Console.BackgroundColor = ConsoleColor.Black;
}
else
{
Console.Write(" ");
}
}
}
}
catch (Exception)
{

}
string newStr = Console.ReadLine();
word = String.IsNullOrEmpty(newStr) ? word : newStr;

}

}
}
}



你可能感兴趣的:(命令行)