A
Ayende Rahien
I've a problem using a datagird, for some reason I keep getting the scroll
bars of the datagrid on top of the grid itself.
Moreover, the window is big enough that I don't need the scrollbars.
It's kind of hard to explain, please look here for example:
http://ayende.freewebspace.com/bad datagrid.JPG
This is where I create the tab pages, FillDataTable() fills the datagrid
with rows.
The code that I'm using is:
tp = new TabPage(q.Name);
dg = new DataGrid();
dg.BeginInit();
dg.SuspendLayout();
dg.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
dg.HeaderForeColor = System.Drawing.SystemColors.ControlText;
dg.Location = new System.Drawing.Point(8, 8);
dg.Name = q.Name;
dg.Dock = DockStyle.Fill;
dt = new DataTable(q.Name);
Name = new DataColumn("Name",Type.GetType("System.String"));
Value = new DataColumn("Value",Type.GetType("System.String"));
dt.Columns.AddRange(new DataColumn[]{Name,Value});
FillDataTable(dt,q);
dg.DataSource = dt;
dg.ReadOnly = true;
dg.PreferredColumnWidth = 150;
dg.AllowSorting = false;
dg.CaptionText = q.Name;
dg.ColumnHeadersVisible = false;
dg.RowHeadersVisible = false;
dg.ResumeLayout();
dg.EndInit();
tp.Controls.Add(dg);
QuotesTab.TabPages.Add(tp);
P.S.
How do I make the columns spread on all the screen?
(Actually, I just want the second column to do that.)
bars of the datagrid on top of the grid itself.
Moreover, the window is big enough that I don't need the scrollbars.
It's kind of hard to explain, please look here for example:
http://ayende.freewebspace.com/bad datagrid.JPG
This is where I create the tab pages, FillDataTable() fills the datagrid
with rows.
The code that I'm using is:
tp = new TabPage(q.Name);
dg = new DataGrid();
dg.BeginInit();
dg.SuspendLayout();
dg.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
dg.HeaderForeColor = System.Drawing.SystemColors.ControlText;
dg.Location = new System.Drawing.Point(8, 8);
dg.Name = q.Name;
dg.Dock = DockStyle.Fill;
dt = new DataTable(q.Name);
Name = new DataColumn("Name",Type.GetType("System.String"));
Value = new DataColumn("Value",Type.GetType("System.String"));
dt.Columns.AddRange(new DataColumn[]{Name,Value});
FillDataTable(dt,q);
dg.DataSource = dt;
dg.ReadOnly = true;
dg.PreferredColumnWidth = 150;
dg.AllowSorting = false;
dg.CaptionText = q.Name;
dg.ColumnHeadersVisible = false;
dg.RowHeadersVisible = false;
dg.ResumeLayout();
dg.EndInit();
tp.Controls.Add(dg);
QuotesTab.TabPages.Add(tp);
P.S.
How do I make the columns spread on all the screen?
(Actually, I just want the second column to do that.)