나는 20 행과 3 열로 grid control
을 설계했습니다. 첫 번째 열에서 일부 하드 코딩 된 문자열을 puted하고 체크 된 검사되지 않은 동작을 사용하여 사용자가 수정할 수 있도록 checkBox
을 넣으려고합니다.이 코드는 코드 아래에 QueryCellInfo
이벤트로 작성했지만 작동하지는 않습니다.사용자가 Grid Control에서 CheckBox를 수정할 수 있도록 CheckBox를 선택 및 선택 취소하는 방법은 무엇입니까?
어떻게 작성합니까?
친절히 제안합니다. 다음은
의 코드 내 일부입니다 : 수동 다음은 당신이 원하는대로 작동합니다 그리드 속성을 수동으로 체크 박스와 같은 열을 설정 컬럼 속성을 정의하여이 작업을 수행 할 수 있습니다
public partial class Form1 : Form
{
System.Windows.Forms.Timer t1 = new System.Windows.Forms.Timer();
private Syncfusion.Windows.Forms.Grid.GridControl gridControlDownloadScript = new Syncfusion.Windows.Forms.Grid.GridControl();
public Form1()
{
// this.gridControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro;
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
gridControl1.Model.RowCount = 20;
gridControl1.Model.ColCount = 3;
this.gridControl1.VScrollPixel = true;
this.gridControl1.HScrollPixel = true;
this.gridControl1[0, 1].Text = "EMPLOYEE";
this.gridControl1[0, 2].Text = "CHECKBOX";
this.gridControl1[0, 3].Text = " ";
this.gridControl1[1, 1].Text = "Rahul Verma";
this.gridControl1[2, 1].Text = "MAnish Desai";
this.gridControl1[3, 1].Text = "Mohan Pothala";
this.gridControl1[4, 1].Text = "Dhanraj Dhoke";
gridControl1.Model.RowCount = 20;
gridControl1.Model.ColCount = 3;
gridControl1.QueryCellInfo += new GridQueryCellInfoEventHandler(GridQueryCellInfo);
gridControl1.SaveCellInfo += new GridSaveCellInfoEventHandler(GridSaveCellInfo);
gridControl1.QueryRowCount += gridControl1_QueryRowCount;
gridControl1.QueryColCount += gridControl1_QueryColCount;
this.gridControl1.HScrollBehavior = GridScrollbarMode.Disabled;
this.gridControl1.VScrollBehavior = GridScrollbarMode.Disabled;
this.gridControl1.ColWidths.ResizeToFit(GridRangeInfo.Cols(1, 1));
this.gridControl1.RowHeights.ResizeToFit(GridRangeInfo.Rows(1, 20));
t1.Interval = 250;
t1.Tick += new EventHandler(IncreaseProgressBar);
}
private void CellClick(object sender, GridCellClickEventArgs e)
{
}
private void IncreaseProgressBar(object sender, EventArgs e)
{
progressBar1.Increment(5);
progressBar1.Minimum = 0;
progressBar1.Maximum = 100;
lblProgress.Text = progressBar1.Value.ToString() + "%";
if (progressBar1.Value == progressBar1.Maximum)
t1.Stop();
}
private void gridControl1_QueryColCount(object sender, GridRowColCountEventArgs e)
{
}
private void gridControl1_QueryRowCount(object sender, GridRowColCountEventArgs e)
{
}
private void GridQueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
int i = 0;
while (i++ < 4)
{
if (i == 0 || i == 1 || i == 4 || i == 6 || i == 9 || i == 11 || i == 14)
{
continue;
}
else if (e.RowIndex == i && e.ColIndex == 2)
{
e.Style.CellType = GridCellTypeName.CheckBox;
e.Style.Description = "";
this.gridControl1[i, 2].CheckBoxOptions = new GridCheckBoxCellInfo("True", "False", string.Empty, false);
e.Style.CheckBoxOptions.CheckedValue = "true";
e.Style.CellValue = "true";
}
}
if (e.RowIndex > 0 && e.ColIndex > 0)
{
}
}
사용하는 기술은 무엇입니까? 양식을 얻으시겠습니까? WPF? 또한 "On Demand"가 의미하는 바는 사용자가 올바르게 수정하기를 원하십니까? – Emad
@Emad, win forms.yes를 사용하고 있습니다. 사용자가 수정하도록하십시오. 죄송합니다. –