【发布时间】:2015-11-09 09:23:03
【问题描述】:
我是编程初学者。
我创建了一个 sql 查询来填充 DataGridView 并在 Column[0] 中添加了 CheckBox 列。我创建了检查事件。但我不知道如何向前迈进。我想在
第一步:添加检查完成按钮和事件以仅显示选中的列。
第二步: 以某种方式打印所有选定的列行单元格 1(名称)和单元格 2(ID)。
第三步:我想创建一个模板,以在矩形或某些对象内将此名称和 ID 打印为 A4 格式。
因为我是新来的,所以我需要很多帮助!
提前致谢!
ps:每一步都会对我有很大帮助!
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (string.Compare(dataGridView1.CurrentCell.OwningColumn.Name, "Checked") == 0)
{
bool checkBoxStatus = Convert.ToBoolean(dataGridView1.CurrentCell.EditedFormattedValue);
//"CheckBoxColumn" column value is checked or not.
if (checkBoxStatus)
{
MessageBox.Show("1");//for check it works or not
}
else
{
MessageBox.Show("0");//for check it works or not
}
}
}
【问题讨论】:
标签: c# winforms printing datagridview