最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#控制臺(tái)應(yīng)用程序中輸出彩色字體

 更新時(shí)間:2017年05月26日 10:05:43   作者:雲(yún)霏霏  
這篇文章主要為大家詳細(xì)介紹了C#控制臺(tái)應(yīng)用程序中輸出彩色字體的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了C#控制臺(tái)輸出彩色字體的具體代碼,供大家參考,具體內(nèi)容如下

using System;

class Example
{
 public static void Main() 
 {
  // Get a string array with the names of ConsoleColor enumeration members.
  String[] colorNames = ConsoleColor.GetNames(typeof(ConsoleColor));

  // Display each foreground color except black on a constant black background.
  Console.WriteLine("All the foreground colors (except Black) on a constant black background:");

  foreach (string colorName in colorNames)
  {
   // Convert the string representing the enum name to the enum value.
   ConsoleColor color = (ConsoleColor) Enum.Parse(typeof(ConsoleColor), colorName);

   if (color == ConsoleColor.Black) continue;

   Console.Write("{0,11}: ", colorName);
   Console.BackgroundColor = ConsoleColor.Black;
   Console.ForegroundColor = color;
   Console.WriteLine("This is foreground color {0}.", colorName);
   // Restore the original foreground and background colors.
   Console.ResetColor();
  }
  Console.WriteLine();

  // Display each background color except white with a constant white foreground.
  Console.WriteLine("All the background colors (except White) with a constant white foreground:");

  foreach (string colorName in colorNames)
  {
   // Convert the string representing the enum name to the enum value.
   ConsoleColor color = (ConsoleColor) Enum.Parse(typeof(ConsoleColor), colorName);

   if (color == ConsoleColor.White) continue;

   Console.Write("{0,11}: ", colorName);
   Console.ForegroundColor = ConsoleColor.White;
   Console.BackgroundColor = (ConsoleColor) Enum.Parse(typeof(ConsoleColor), colorName);
   Console.WriteLine("This is background color {0}.", colorName);
   Console.ResetColor();
  }
 }
}

效果圖:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • C#實(shí)現(xiàn)圖像反色的方法

    C#實(shí)現(xiàn)圖像反色的方法

    這篇文章主要介紹了C#實(shí)現(xiàn)圖像反色的方法,涉及C#操作圖像顏色轉(zhuǎn)換的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-04-04
  • C#交錯(cuò)數(shù)組用法實(shí)例

    C#交錯(cuò)數(shù)組用法實(shí)例

    這篇文章主要介紹了C#交錯(cuò)數(shù)組用法,較為詳細(xì)的分析了交錯(cuò)數(shù)組的概念、用法并實(shí)例分析了交錯(cuò)數(shù)組的使用技巧,需要的朋友可以參考下
    2015-04-04
  • C#中匿名方法與委托的關(guān)系介紹

    C#中匿名方法與委托的關(guān)系介紹

    這篇文章介紹了C#中匿名方法與委托的關(guān)系,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-08-08
  • Winform實(shí)現(xiàn)鼠標(biāo)可穿透的窗體鏤空效果

    Winform實(shí)現(xiàn)鼠標(biāo)可穿透的窗體鏤空效果

    這篇文章主要介紹了Winform實(shí)現(xiàn)鼠標(biāo)可穿透的窗體鏤空效果的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-10-10
  • C# 實(shí)現(xiàn)ADSL自動(dòng)斷網(wǎng)和撥號(hào)的方法(適用于撥號(hào)用戶)

    C# 實(shí)現(xiàn)ADSL自動(dòng)斷網(wǎng)和撥號(hào)的方法(適用于撥號(hào)用戶)

    下面小編就為大家?guī)?lái)一篇C# 實(shí)現(xiàn)ADSL自動(dòng)斷網(wǎng)和撥號(hào)的方法(適用于撥號(hào)用戶)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-12-12
  • C#實(shí)現(xiàn)更改MDI窗體背景顏色的方法

    C#實(shí)現(xiàn)更改MDI窗體背景顏色的方法

    這篇文章主要介紹了C#實(shí)現(xiàn)更改MDI窗體背景顏色的方法,涉及C#窗體背景色的設(shè)置技巧,非常簡(jiǎn)單實(shí)用,需要的朋友可以參考下
    2015-08-08
  • C#通過(guò)PInvoke調(diào)用c++函數(shù)的備忘錄的實(shí)例詳解

    C#通過(guò)PInvoke調(diào)用c++函數(shù)的備忘錄的實(shí)例詳解

    這篇文章主要介紹了C#通過(guò)PInvoke調(diào)用c++函數(shù)的備忘錄的實(shí)例以及相關(guān)知識(shí)點(diǎn)內(nèi)容,有興趣的朋友們學(xué)習(xí)下。
    2019-08-08
  • C#調(diào)用usb攝像頭的實(shí)現(xiàn)方法

    C#調(diào)用usb攝像頭的實(shí)現(xiàn)方法

    這篇文章主要介紹了C#調(diào)用usb攝像頭的實(shí)現(xiàn)方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02
  • 詳細(xì)解析C#多線程同步事件及等待句柄

    詳細(xì)解析C#多線程同步事件及等待句柄

    本篇文章主要介紹了C#多線程同步事件及等待句柄,希望通過(guò)本篇的介紹能對(duì)常見(jiàn)的線程同步方法有一個(gè)整體的認(rèn)識(shí),有需要的可以了解一下。
    2016-11-11
  • 分享用于操作FTP的客戶端C#類

    分享用于操作FTP的客戶端C#類

    用.net自帶的FtpWebRequest做的ftp客戶端得程序,有一個(gè)功能實(shí)現(xiàn)起來(lái)會(huì)非??嚯y,就是移動(dòng)文件和文件夾的功能。所以后來(lái)又找了一個(gè)類,用socket實(shí)現(xiàn)的,發(fā)現(xiàn)比用ftpWebRequest功能要強(qiáng)?;镜膄tp客戶端得命令都實(shí)現(xiàn)了。
    2015-05-05

最新評(píng)論

兴国县| 青海省| 江油市| 福海县| 泗水县| 新郑市| 旌德县| 黄浦区| 武强县| 大厂| 特克斯县| 南汇区| 大兴区| 合江县| 苍梧县| 晋州市| 阳山县| 额济纳旗| 合作市| 武城县| 宁夏| 仁寿县| 敦化市| 黄陵县| 平乐县| 东乡族自治县| 来凤县| 藁城市| 象山县| 静海县| 苍山县| 岚皋县| 清徐县| 阿拉善右旗| 昭觉县| 玉环县| 安化县| 普定县| 志丹县| 宜君县| 鄂托克前旗|