如何在DATAGRID的一行中添加CHECKBOX
不是CHECKBOX列!!
--------------
顺便问问如何只在DATAGRID的一个单元格中添加CHECKBOX!!!!!!

解决方案 »

  1.   

    Button bt1 = new Button();
                bt1.Name = "sss";
                
                bt1.Size = new System.Drawing.Size(15, 15);
                bt1.Location = new System.Drawing.Point((dataGridView1.Rows[0].Cells[0].Size.Width - bt1.Width) / 2, (dataGridView1.Rows[0].Cells[0].Size.Height - bt1.Height) / 2);
                bt1.TabIndex = 0;
                bt1.Text = "ss";
                bt1.UseVisualStyleBackColor = true;
                bt1.Click+=new EventHandler(bt1_Click);            this.dataGridView1.Controls.Add(bt1);只是显示在那个位置而已
      

  2.   

    这是我曾经做的项目中的一段代码,希望能给你参考
    private void TextBox_GotFocus(object sender, EventArgs e)
    {
    DataTable dtStandardName=new DataTable();
    PreRow=(DataRowView)bind.Current;
    dtStandardName=GetStandardName();
    ComboBox mycombobox=new ComboBox();
    mycombobox.Leave+=new EventHandler(mycombobox_Leave);
    mycombobox.SelectedIndexChanged+=new EventHandler(mycombobox_SelectedIndexChanged);
    mycombobox.Items.Clear();
    Dir.GetList(dtStandardName,"StandardName",EnmGetListMode.Normal,mycombobox);
    mycombobox.Items.Insert(0,String.Empty);
    ((TextBox)sender).Controls.Add(mycombobox);
    mycombobox.Text=((TextBox)sender).Text;
    mycombobox.Size=new Size(((TextBox)sender).Width,((TextBox)sender).Height);

    this.colStandardName.TextBox.GotFocus-=new EventHandler(TextBox_GotFocus);
    this.colStandardName1.TextBox.GotFocus-=new EventHandler(TextBox_GotFocus);
    mycombobox.Focus();
    }
    this.colStandardName.TextBox.GotFocus-=new EventHandler(TextBox_GotFocus);
    this.colStandardName1.TextBox.GotFocus-=new EventHandler(TextBox_GotFocus);
    mycombobox.Focus();
      

  3.   

    如何单独地改变某个CELL的属性改为checkbox?