Esempio n. 1
0
        public FormCharacterBasics(Actor actor)
        {
            InitializeComponent();
            ComboBoxUtil.PopulateComboBoxWithEnum(cbAlignment, typeof(Actor.Alignment));
            ComboBoxUtil.PopulateComboBoxWithEnum(cbGender, typeof(Actor.Gender));

            ThisActor = actor;
            LoadActor();
        }
Esempio n. 2
0
        public static void PopulateComboBoxWithEnum(ComboBox box, Type t)
        {
            string[]  names  = Enum.GetNames(t);
            int[]     values = Enum.GetValues(t) as int[];
            ArrayList alist  = new ArrayList(names.Length);

            for (int i = 0; i < names.Length; i++)
            {
                names[i] += ',' + values[i].ToString();
                alist.Add(names[i].Split(','));
            }

            CBItem[] items = ComboBoxUtil.MakeCBItemsFromStringArrayList(alist);
            foreach (CBItem item in items)
            {
                box.Items.Add(item);
            }
        }