private void DrawMessage() { TextGraphics.DrawLineH(2, 2, CLI.Width - 4, ' ', Color.White, Color.Cyan); TextGraphics.DrawString(2, 2, " C COLOR VALUE", Color.Black, Color.Cyan); TextGraphics.DrawLineH(0, 3, CLI.Width, ' ', Color.White, Color.Black); int dx = 3, dy = 4; Color bg = Color.Black; // black TextGraphics.DrawChar(dx, dy, '#', Color.Black, bg); TextGraphics.DrawString(dx + 5, dy, "BLACK", Color.White, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.Black, "X2"), Color.Yellow, Color.Blue); dy++; // dark gray TextGraphics.DrawChar(dx, dy, '#', Color.DarkGray, bg); TextGraphics.DrawString(dx + 5, dy, "DARK GRAY", Color.DarkGray, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.DarkGray, "X2"), Color.Yellow, Color.Blue); dy++; // gray TextGraphics.DrawChar(dx, dy, '#', Color.Gray, bg); TextGraphics.DrawString(dx + 5, dy, "GRAY", Color.Gray, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.Gray, "X2"), Color.Yellow, Color.Blue); dy++; // white TextGraphics.DrawChar(dx, dy, '#', Color.White, bg); TextGraphics.DrawString(dx + 5, dy, "WHITE", Color.White, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.White, "X2"), Color.Yellow, Color.Blue); dy++; // dark red TextGraphics.DrawChar(dx, dy, '#', Color.DarkRed, bg); TextGraphics.DrawString(dx + 5, dy, "DARK RED", Color.DarkRed, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.DarkRed, "X2"), Color.Yellow, Color.Blue); dy++; // red TextGraphics.DrawChar(dx, dy, '#', Color.Red, bg); TextGraphics.DrawString(dx + 5, dy, "RED", Color.Red, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.Red, "X2"), Color.Yellow, Color.Blue); dy++; // dark yellow TextGraphics.DrawChar(dx, dy, '#', Color.DarkYellow, bg); TextGraphics.DrawString(dx + 5, dy, "DARK YELLOW", Color.DarkYellow, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.DarkYellow, "X2"), Color.Yellow, Color.Blue); dy++; // yellow TextGraphics.DrawChar(dx, dy, '#', Color.Yellow, bg); TextGraphics.DrawString(dx + 5, dy, "YELLOW", Color.Yellow, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.Yellow, "X2"), Color.Yellow, Color.Blue); dy++; // dark green TextGraphics.DrawChar(dx, dy, '#', Color.DarkGreen, bg); TextGraphics.DrawString(dx + 5, dy, "DARK GREEN", Color.DarkGreen, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.DarkGreen, "X2"), Color.Yellow, Color.Blue); dy++; // green TextGraphics.DrawChar(dx, dy, '#', Color.Green, bg); TextGraphics.DrawString(dx + 5, dy, "GREEN", Color.Green, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.Green, "X2"), Color.Yellow, Color.Blue); dy++; // dark cyan TextGraphics.DrawChar(dx, dy, '#', Color.DarkCyan, bg); TextGraphics.DrawString(dx + 5, dy, "DARK CYAN", Color.DarkCyan, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.DarkCyan, "X2"), Color.Yellow, Color.Blue); dy++; // cyan TextGraphics.DrawChar(dx, dy, '#', Color.Cyan, bg); TextGraphics.DrawString(dx + 5, dy, "CYAN", Color.Cyan, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.Cyan, "X2"), Color.Yellow, Color.Blue); dy++; // dark blue TextGraphics.DrawChar(dx, dy, '#', Color.DarkBlue, bg); TextGraphics.DrawString(dx + 5, dy, "DARK BLUE", Color.Blue, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.DarkBlue, "X2"), Color.Yellow, Color.Blue); dy++; // blue TextGraphics.DrawChar(dx, dy, '#', Color.Blue, bg);; TextGraphics.DrawString(dx + 5, dy, "BLUE", Color.Blue, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.Blue, "X2"), Color.Yellow, Color.Blue);; dy++; // dark magenta TextGraphics.DrawChar(dx, dy, '#', Color.DarkMagenta, bg); TextGraphics.DrawString(dx + 5, dy, "DARK MAGENTA", Color.DarkMagenta, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.DarkMagenta, "X2"), Color.Yellow, Color.Blue); dy++; // magenta TextGraphics.DrawChar(dx, dy, '#', Color.Magenta, bg); TextGraphics.DrawString(dx + 5, dy, "MAGENTA", Color.Magenta, Color.Blue); TextGraphics.DrawString(dx + 28, dy, DataUtils.IntToHex((int)Color.Magenta, "X2"), Color.Yellow, Color.Blue); dy++; // exit message TextGraphics.DrawString(2, CLI.Height - 2, "Press any key to exit...", Color.White, Color.Blue); }
private static void ReadInputMenu() { // draw document Draw(); // draw menu TextGraphics.FillRect(0, 1, 20, 5, ' ', Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 1, "New", Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 2, "Open...", Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 3, "Save", Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 4, "Save As...", Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 5, "Exit", Color.White, Shell.TitleBarColor); TextGraphics.DrawChar(0, StartY + MenuIndex, '>', Color.Yellow, Shell.TitleBarColor); CLI.SetCursorPos(0, StartY + MenuIndex); try { ConsoleKeyInfo key = CLI.ReadKey(true); // return to document if (key.Key == ConsoleKey.Escape) { Draw(); ReadInput(); } // move up else if (key.Key == ConsoleKey.UpArrow) { if (MenuIndex > 0) { MenuIndex--; } } // move down else if (key.Key == ConsoleKey.DownArrow) { if (MenuIndex < 4) { MenuIndex++; } } // select option else if (key.Key == ConsoleKey.Enter) { // new document if (MenuIndex == 0) { Clear(true); } // load document if (MenuIndex == 1) { Load(); } // save document if (MenuIndex == 2) { if (PMFAT.FileExists(CurrentFile)) { Save(); } else { SaveAs(); } } // save document as if (MenuIndex == 3) { SaveAs(); } // exit if (MenuIndex == 4) { Exit(); } Draw(); ReadInput(); } ReadInputMenu(); } catch (Exception ex) { Clear(false); CLI.Write("[FATAL] ", Color.Red); CLI.WriteLine(ex.Message, Color.White); } }