Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace C_sharp_Light
- {
- class Program
- {
- static void Main(string[] args)
- {
- string message = "Сообщение не установлено";
- int x, y;
- x = 0;
- y = 8;
- bool isOpen = true;
- ConsoleColor defaultForeground = ConsoleColor.White;
- while (isOpen)
- {
- Console.SetCursorPosition(0, 0);
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Команды:\nExit - выход\nSet background - установить задний цвет\nSet foreground - Установить цвет шрифта\n" +
- "Set message - установить сообщение для вывода\nShow message - вывести сообщение\nSet Cursor - установить позицию курсора по умолчанию для ввода команд");
- Console.ForegroundColor = defaultForeground;
- Console.SetCursorPosition(x, y);
- switch (Console.ReadLine())
- {
- case "Exit":
- isOpen = false;
- break;
- case "Set background":
- Console.Clear();
- Console.WriteLine("1 - Черный\n2-зелёный\n3-серый");
- switch (Convert.ToInt32(Console.ReadLine()))
- {
- case 1:
- Console.BackgroundColor = ConsoleColor.Black;
- break;
- case 2:
- Console.BackgroundColor = ConsoleColor.DarkGreen;
- break;
- case 3:
- Console.BackgroundColor = ConsoleColor.DarkGray;
- break;
- }
- break;
- case "Set foreground":
- Console.Clear();
- Console.WriteLine("1 - белый\n2-синий\n3-фиолетовый");
- switch (Convert.ToInt32(Console.ReadLine()))
- {
- case 1:
- Console.ForegroundColor = ConsoleColor.White;
- break;
- case 2:
- Console.ForegroundColor = ConsoleColor.Blue;
- break;
- case 3:
- Console.ForegroundColor = ConsoleColor.Magenta;
- break;
- }
- defaultForeground = Console.ForegroundColor;
- break;
- case "Set message":
- Console.Clear();
- message = Console.ReadLine();
- break;
- case "Show message":
- Console.WriteLine(message);
- break;
- case "Set Cursor":
- Console.Clear();
- Console.Write("Введите величину отступа с левого края - ");
- x = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите величину отступа с верхнего края - ");
- y = Convert.ToInt32(Console.ReadLine());
- break;
- default:
- Console.WriteLine("Неизвестная команда");
- break;
- }
- if (isOpen)
- {
- Console.ReadKey();
- Console.Clear();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement