C# datetimepicker calendar font [日期時間UI元件時間大小設定]

C# datetimepicker calendar font [日期時間UI元件時間大小設定]

C# datetimepicker calendar font [日期時間UI元件時間大小設定]


資料來源: https://blog.csdn.net/chenlu5201314/article/details/87878777

https://docs.microsoft.com/zh-tw/dotnet/core/compatibility/windows-forms/6.0/application-bootstrap


Github:https://github.com/jash-git/CS_datetimepicker-calendar-font


Program.cs 

namespace WinForms_DateTimePicker
{
    internal static class Program
    {
        /// <summary>
        ///  The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            // To customize application configuration such as set high DPI settings or default font,
            // see https://aka.ms/applicationconfiguration.

            //ApplicationConfiguration.Initialize();//net6.0原生-影響dateTimePicker1.CalendarFont屬性
            
            //net6.0之前ApplicationConfiguration.Initialize()的程式碼為以下三行
            //Application.EnableVisualStyles();//net6.0之前-影響dateTimePicker1.CalendarFont屬性
            Application.SetCompatibleTextRenderingDefault(false);
            Application.SetHighDpiMode(HighDpiMode.SystemAware);

            Application.Run(new Form1());
        }
    }
}


Form1.cs

namespace WinForms_DateTimePicker
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            dateTimePicker1.Font = new Font("Courier New", 18.0F, FontStyle.Italic, GraphicsUnit.Point, ((Byte)(0)));
            dateTimePicker1.CalendarFont = new Font("Courier New", 36F, FontStyle.Italic, GraphicsUnit.Point, ((Byte)(0)));
        }
    }
}

One thought on “C# datetimepicker calendar font [日期時間UI元件時間大小設定]

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *