BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
private void Form1_Load(object sender, System.EventArgs e)
{
_grid.Model.Rows.HeaderCount = 0;
_grid.Model.Cols.HeaderCount = 1;
_grid.DataSource = _createTable(25, 50);
_grid.Model.Cols.SetFrozenCount(1, true);
}
private void menuFreeze_Click(object sender, System.EventArgs e)
{
int rowIndex, colIndex;
this._grid.PointToRowCol(_rightClickPoint, out rowIndex, out colIndex);
if (colIndex > this._grid.Model.Cols.HeaderCount
&& this._grid.Model.ColWidths.GetTotal(0,colIndex) < this._grid.ClientSize.Width)
{
this._grid.Model.Cols.FrozenCount = colIndex;
_grid.LeftColIndex = colIndex + 1;
}
}
//at the bottom of form.load
this._grid.HScrollPixel = false;
this._grid.Model.QueryColWidth += new GridRowColSizeEventHandler(Model_QueryColWidth);
this._grid.HScrollBar.Scroll += new ScrollEventHandler(HScrollBar_Scroll);
//the handlers private void HScrollBar_Scroll(object sender, ScrollEventArgs e) { if(this._grid.ViewLayout.LastVisibleCol == this._grid.Model.ColCount) this._grid.InvalidateRange(GridRangeInfo.Col(this._grid.ViewLayout.LastVisibleCol)); } private void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e) { if(e.Index == this._grid.Model.ColCount) { //starts at 1 as headers are hidden... int w = this._grid.Model.ColWidths.GetTotal(1, this._grid.Model.Cols.FrozenCount) + this._grid.Model.ColWidths.GetTotal(this._grid.LeftColIndex, e.Index - 1); e.Size = this._grid.ClientSize.Width - w; if(e.Size > 0) e.Handled = true; } }