コード例 #1
0
        public void DataBind(CampaignData.SortableBindingList <Encounter> list)
        {
            List <string> VisibleColumns = new List <string>(new string[] { "Name", "Challenge", "Description" });

            //this.EncounterList.Columns.Clear();

            this.EncounterList.DataSource = list;
            //Hide them all to start
            if (this.EncounterList.Columns.Count > 0)
            {
                for (int a = 0; a < this.EncounterList.ColumnCount; a++)
                {
                    //Enable the ones we want
                    if (!VisibleColumns.Contains(this.EncounterList.Columns[a].Name))
                    {
                        this.EncounterList.Columns[a].Visible = false;
                    }
                }
            }


            DataGridViewButtonColumn BattleCol = new DataGridViewButtonColumn();

            BattleCol.HeaderText = "Start";
            BattleCol.Text       = "Battle";
            BattleCol.UseColumnTextForButtonValue = true;

            this.EncounterList.Columns.Add(BattleCol);
        }
コード例 #2
0
        public void DataBind(CampaignData.SortableBindingList <Monster> list)
        {
            this.MonstersGrid.Columns.Clear();

            this.MonstersGrid.AutoGenerateColumns = false;
            this.MonstersGrid.DataSource          = list;
            this.MonstersGrid.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "Name", DataPropertyName = "Name", ReadOnly = true, AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
            });
            this.MonstersGrid.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "Source", DataPropertyName = "Source", ReadOnly = true, AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader
            });
            this.MonstersGrid.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "Type", DataPropertyName = "DisplayType", ReadOnly = true, AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells, Resizable = DataGridViewTriState.True
            });
            this.MonstersGrid.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "Challenge", DataPropertyName = "Challenge", ReadOnly = true, AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader
            });


            DataGridViewButtonColumn EncounterCol = new DataGridViewButtonColumn();

            EncounterCol.HeaderText = "Add";
            EncounterCol.Text       = "Encounter";
            EncounterCol.UseColumnTextForButtonValue = true;

            this.MonstersGrid.Columns.Add(EncounterCol);

            DataGridViewButtonColumn BattleCol = new DataGridViewButtonColumn();

            BattleCol.HeaderText = "Add";
            BattleCol.Text       = "Battle";
            BattleCol.UseColumnTextForButtonValue = true;

            this.MonstersGrid.Columns.Add(BattleCol);

            this.MonstersGrid.AutoResizeColumns();
        }