コード例 #1
0
        private DataTable CreateTable(ITableInfo options)
        {
            var tbl = new DataTable();

            foreach (var col in options.GetColumnInfo())
            {
                tbl.Columns.Add(new DataColumn(col.Heading, col.DataType)); // txtBox. Columns.Add(new DataGridViewColumn());
            }
            foreach (var row in options.TableRows)
            {
                tbl.Rows.Add(row.RowData);
            }
            return(tbl);
        }
コード例 #2
0
        public DisplayTableDialog(ITableInfo options) : base(options.TableTitle, MessageBoxButtons.OK)
        {
            //this.Text = title;
            this.Height = 600;
            var txtBox = new DataGridView()
            {
                Dock = DockStyle.Fill
            };

            txtBox.ReadOnly = true;
            foreach (var col in options.GetColumnInfo())
            {
                //txtBox. Columns.Add(new DataGridViewColumn());
            }
            txtBox.AutoGenerateColumns = true;
            txtBox.DataSource          = CreateTable(options);// options.TableRows;
            //txtBox.Select(0, 0);

            this.ClientPanel.Controls.Add(txtBox);
            this.InitiallyFocussedControl = txtBox;
        }