WinForm里使用MaterialSkin


using System;
using System.Windows.Forms;

namespace WinFormMaterialSkinDemo
{
    /// <summary>
    ///     WinForm里使用MaterialSkin LDH @ 2021-3-28
    ///     Nuget: MaterialSkin.2
    ///     Install-Package MaterialSkin.2
    /// </summary>
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            BindComboBox();
        }

        private void BindComboBox()
        {
            materialComboBox1.Items.Clear();
            materialComboBox1.Items.AddRange(new object[]
            {
                new Student {Id = 1, Name = "Monday"},
                new Student {Id = 2, Name = "Tuesday"},
                new Student {Id = 3, Name = "Wednesday"},
                new Student {Id = 4, Name = "Thursday"},
                new Student {Id = 5, Name = "Friday"},
                new Student {Id = 6, Name = "Saturday"},
                new Student {Id = 7, Name = "Sunday"}
            });

            materialComboBox1.SelectedIndex = 0;
        }

        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            Environment.Exit(0);
        }
    }

    public class Student
    {
        public int Id { get; set; }
        public string Name { get; set; }

        public override string ToString()
        {
            return $"{Id},{Name}";
        }
    }
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM