BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
private void InitializeDataTable()
{
int recordCount = 100;
Random random = new Random(DateTime.Now.Millisecond);
string[] states = new string[]{"North Carolina", "South Carolina", "Washington", "Nevada", "Ohio"};
int numStates = states.GetLength(0);
string nameFormat = "Name{0}";
this.table = new DataTable("Test");
DataColumn col = table.Columns.Add();
col.DataType = typeof(string);
col.ColumnName = "Name";
col = table.Columns.Add();
col.DataType = typeof(string);
col.ColumnName = "State";
col = table.Columns.Add();
col.DataType = typeof(int);
col.ColumnName = "Zip";
for(int i = 0; i < recordCount; i++)
{
DataRow row = this.table.NewRow();
row["Name"] = string.Format(nameFormat, i);
row["State"] = states[random.Next(numStates-1)];
row["Zip"] = random.Next(9999);
this.table.Rows.Add(row);
}
}
Stefan Hoenig
//in formload
this.gridGroupingControl1.TableControl.Model.QueryColWidth += new GridRowColSizeEventHandler(grid_QueryColWidth);
this.SCROLLBARWIDTH = SystemInformation.VerticalScrollBarWidth;
this.lastCol = myDataTable.Columns.Count + 1;
//the handler private void grid_QueryColWidth(object sender, GridRowColSizeEventArgs e) { if(e.Index == this.lastCol) { int vscrollwidth = ((this.gridGroupingControl1.TableControl.Model.RowHeights.GetTotal(0, this.gridGroupingControl1.TableControl.Model.RowCount) + this.gridGroupingControl1.TableOptions.CaptionRowHeight) > this.gridGroupingControl1.ClientSize.Height) ? SCROLLBARWIDTH :0; e.Size = this.gridGroupingControl1.ClientSize.Width - this.gridGroupingControl1.TableControl.Model.ColWidths.GetTotal(0, e.Index - 1) - vscrollwidth; e.Handled = true; } }