comboxバインド列挙と読み出し列挙


/// 
    ///      
    /// 
    /// 
    public class BindComboxEnumType
    {
        /// 
        ///      
        /// 
        public string Name { get; set; }

        /// 
        ///   
        /// 
        public T Type { get; set; }

        private static readonly List> bindTyps;

        static BindComboxEnumType()
        {
            bindTyps = new List>();

            foreach (var name in Enum.GetNames(typeof(T)))
            {
                bindTyps.Add(new BindComboxEnumType()
                {
                    Name = name,
                    Type = (T)Enum.Parse(typeof(T), name)
                });
            }
        }

        /// 
        ///        
        /// 
        public static List> BindTyps
        {
            get { return bindTyps; }
        }
    }
//                
cbStyle.DataSource = BindComboxEnumType.BindTyps;
            cbStyle.DisplayMember = "Name";
            cbStyle.ValueMember = "Type";
//          
(Microsoft.Office.Core.MsoPresetTextEffect)cbStyle.SelectedValue