예제 #1
0
        private void GetV4PlusStyleGridView(DataGridView dataGridView)
        {
            //dataGridView.AutoGenerateColumns = false;
            V4PlusFile subtitleFile = mSubtitleFile as V4PlusFile;

            EnumHelper<V4PlusStyleHeader> styleHelper = new EnumHelper<V4PlusStyleHeader>();
            Dictionary<V4PlusStyleHeader, string> enumDictionary = styleHelper.GetEnumsWithDescriptions();

            //DataGridViewColumnCollection columns = new DataGridViewColumnCollection(dataGridView);
            //dataGridView.Columns.Clear();

            //foreach (string styleDescription in enumDictionary.Values)
            //{
            //    DataGridViewColumn column = new DataGridViewColumn();
            //    column.HeaderText = styleDescription;
            //    dataGridView.Columns.Add(column);
            //}

            BindingList<IV4PlusStyle> rows = new BindingList<IV4PlusStyle>();
            rows.AddingNew += new AddingNewEventHandler(subtitleFile.AddingNewStyle);

            IList<IV4PlusStyle> styleValues = subtitleFile.GetStyles();
            foreach(IV4PlusStyle value in styleValues)
            {
                rows.Add(value);
            }

            dataGridView.DataSource = rows;
        }