첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
0.00MB

▶ Program.cs

using System;
using System.Drawing;

namespace TestProject
{
    /// <summary>
    /// 프로그램
    /// </summary>
    class Program
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Static
        //////////////////////////////////////////////////////////////////////////////// Private

        #region 콘솔 색상 구하기 - GetConsoleColor(color)

        /// <summary>
        /// 콘솔 색상 구하기
        /// </summary>
        /// <param name="color">색상</param>
        /// <returns>콘솔 색상</returns>
        private static ConsoleColor GetConsoleColor(Color color)
        {
            int index = (color.R > 128 | color.G > 128 | color.B > 128) ? 8 : 0; // 밝기 비트

            index |= (color.R > 64) ? 4 : 0; // 적색 비트
            index |= (color.G > 64) ? 2 : 0; // 녹색 비트
            index |= (color.B > 64) ? 1 : 0; // 청색 비트

            return (ConsoleColor)index;
        }

        #endregion
        #region 프로그램 시작하기 - Main()

        /// <summary>
        /// 프로그램 시작하기
        /// </summary>
        private static void Main()
        {
            Console.BackgroundColor = GetConsoleColor(Color.Yellow);
            Console.ForegroundColor = GetConsoleColor(Color.Blue  );

            Console.WriteLine("테스트 문자열 입니다.");
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요