Пример #1
0
        public static bool SetForeGroundColour(
            ForeGroundColour foreGroundColour,
            bool brightColours)
        {
            IntPtr nConsole = GetStdHandle(STD_OUTPUT_HANDLE);
            int colourMap;

            if (brightColours)
                colourMap = (int)foreGroundColour |
                    (int)ForeGroundColour.White;
            else
                colourMap = (int)foreGroundColour;

            return SetConsoleTextAttribute(nConsole, colourMap);
        }
Пример #2
0
 public static bool SetForeGroundColour(
     ForeGroundColour foreGroundColour,
     bool brightColours)
 {
     // get the current console handle
     IntPtr nConsole = GetStdHandle(STD_OUTPUT_HANDLE);
     int colourMap;
     // if we want bright colours OR it with white
     if (brightColours)
         colourMap = (int) foreGroundColour |
                     (int) ForeGroundColour.White;
     else
         colourMap = (int) foreGroundColour;
     // call the api and return the result
     return SetConsoleTextAttribute(nConsole, colourMap);
 }
Пример #3
0
        public static bool SetForeGroundColour(
            ForeGroundColour foreGroundColour,
            bool brightColours)
        {
            // get the current console handle
            IntPtr nConsole = GetStdHandle(STD_OUTPUT_HANDLE);
            int    colourMap;

            // if we want bright colours OR it with white
            if (brightColours)
            {
                colourMap = (int)foreGroundColour |
                            (int)ForeGroundColour.White;
            }
            else
            {
                colourMap = (int)foreGroundColour;
            }
            // call the api and return the result
            return(SetConsoleTextAttribute(nConsole, colourMap));
        }
Пример #4
0
 public static bool SetForeGroundColour(
     ForeGroundColour foreGroundColour)
 {
     // default to a bright white-grey
     return SetForeGroundColour(foreGroundColour, true);
 }
Пример #5
0
 public static bool SetForeGroundColour(
     ForeGroundColour foreGroundColour)
 {
     // default to a bright white-grey
     return(SetForeGroundColour(foreGroundColour, true));
 }
Пример #6
0
 public static bool SetForeGroundColour(
     ForeGroundColour foreGroundColour)
 {
     return SetForeGroundColour(foreGroundColour, true);
 }