Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
8261 | Oct 29,2003 10:18 PM UTC | Jun 8,2004 11:43 AM UTC | WinForms | 5 |
![]() |
Tags: GridControl |
GridStyleInfo style = this.gridControl1[2,2];
style.CellType = "Static";
style.Text = "SomeText";
style.ReadOnly = true;
If you want a particular cell to be absolutely immutable (including to OLE DND), then you can handle SaveCellInfo, and not save the change. Make sure you subscribe to the event after you set the cell text otherwise, the change will not take.
//in formload GridStyleInfo style = this.gridControl1[2,2]; style.Text = "SomeText"; this.gridControl1.SaveCellInfo += new GridSaveCellInfoEventHandler(this.gridControl1_SaveCellInfo); //the handler private void gridControl1_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e) { if(e.ColIndex == 2 && e.RowIndex == 2) { e.Handled = true; } }
private void Form1_Load(object sender, System.EventArgs e) { this.gridControl1.ChangeCells(GridRangeInfo.Cells(1,1,5,5), "abc"); this.gridControl1[2,2].BackColor = Color.LightBlue; this.gridControl1[2,2].ReadOnly = true; }
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.