首页 > 代码库 > Show a heart shaped
Show a heart shaped
Windows Form application version:
private void Form1_Load(object sender, EventArgs e)
{
this.BackColor = Color.Red;
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddArc(90, 30, 150, 150, 135, 195);
path.AddArc(220, 30, 150, 150, 210, 195);
path.AddLine(112, 159, 230, 290);
path.AddLine(347, 159, 230, 290);
path.AddLine(347, 159, 112, 159);
this.Region = new Region(path);
}
Console application version:
//Set the text colour as RED here
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine();
for (int i = 0, m = 1; i < 30; i++)
for (int l = 0; l < new[] { 5, 6, 7, 6, 8, 10, 3, 10, 4, 13, 1, 13, 1, 87, 1, 27, 4, 23, 7, 20, 11, 16, 16, 11, 20, 7, 24, 3, 27, 1 }[i]; l++, m++) System.Console.Write((i % 2 > 0 ? "love"[m % 4] : ‘ ‘) + (m % 29 > 0 ? "" : "\n"));
Console.WriteLine();