Пример #1
0
        public static bool SetForeGroundColor(ForeGroundColor foreGroundColor,bool brightColors)
        {
            IntPtr nConsole = GetStdHandle(STD_OUTPUT_HANDLE);
            int colorMap;

            if (brightColors)
                colorMap = (int) foreGroundColor |
                    (int) ForeGroundColor.White;
            else
                colorMap = (int) foreGroundColor;

            return SetConsoleTextAttribute(nConsole, colorMap);
        }
Пример #2
0
        public static bool SetForeGroundColor(
            ForeGroundColor foreGroundColor,
            bool brightColors)
        {
            // get the current console handle
            IntPtr nConsole = GetStdHandle(STD_OUTPUT_HANDLE);
            int colorMap;

            // if we want bright colors OR it with white
            if (brightColors)
                colorMap = (int) foreGroundColor |
                    (int) ForeGroundColor.White;
            else
                colorMap = (int) foreGroundColor;

            // call the api and return the result
            return SetConsoleTextAttribute(nConsole, colorMap);
        }
Пример #3
0
        public static bool SetForeGroundColor(
            ForeGroundColor foreGroundColor,
            bool brightColors)
        {
            // get the current console handle
            IntPtr nConsole = GetStdHandle(STD_OUTPUT_HANDLE);
            int    colorMap;

            // if we want bright colors OR it with white
            if (brightColors)
            {
                colorMap = (int)foreGroundColor |
                           (int)ForeGroundColor.White;
            }
            else
            {
                colorMap = (int)foreGroundColor;
            }

            // call the api and return the result
            return(SetConsoleTextAttribute(nConsole, colorMap));
        }
Пример #4
0
 public static bool SetForeGroundColor(
     ForeGroundColor foreGroundColor)
 {
     // default to a bright white-grey
     return(SetForeGroundColor(foreGroundColor, true));
 }
Пример #5
0
 public static bool SetForeGroundColor(ForeGroundColor foreGroundColor)
 {
     return SetForeGroundColor(foreGroundColor, false);
 }
Пример #6
0
 public static bool SetForeGroundColor(
     ForeGroundColor foreGroundColor)
 {
     // default to a bright white-grey
     return SetForeGroundColor(foreGroundColor, true);
 }