Exemple #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);
        }
Exemple #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);
        }
Exemple #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));
        }
Exemple #4
0
 public static bool SetForeGroundColor(
     ForeGroundColor foreGroundColor)
 {
     // default to a bright white-grey
     return(SetForeGroundColor(foreGroundColor, true));
 }
Exemple #5
0
 public static bool SetForeGroundColor(ForeGroundColor foreGroundColor)
 {
     return SetForeGroundColor(foreGroundColor, false);
 }
Exemple #6
0
 public static bool SetForeGroundColor(
     ForeGroundColor foreGroundColor)
 {
     // default to a bright white-grey
     return SetForeGroundColor(foreGroundColor, true);
 }