示例#1
0
 private static ConsoleColor ColorAttributeToConsoleColor(Interop.mincore.Color c)
 {
     // Turn background colors into foreground colors.
     if ((c & Interop.mincore.Color.BackgroundMask) != 0)
     {
         c = (Interop.mincore.Color)(((int)c) >> 4);
     }
     return((ConsoleColor)c);
 }
示例#2
0
        private static Interop.mincore.Color ConsoleColorToColorAttribute(ConsoleColor color, bool isBackground)
        {
            if ((((int)color) & ~0xf) != 0)
            {
                throw new ArgumentException(SR.Arg_InvalidConsoleColor);
            }
            Contract.EndContractBlock();

            Interop.mincore.Color c = (Interop.mincore.Color)color;

            // Make these background colors instead of foreground
            if (isBackground)
            {
                c = (Interop.mincore.Color)((int)c << 4);
            }
            return(c);
        }