回复 8楼wotangjing的帖子
建议通过合并列头单元格的方式实现。
测试代码如下:
- private void Form1_Load(object sender, EventArgs e)
- {
- FarPoint.Win.Spread.CellType.CheckBoxCellType cktype = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
- cktype.TextAlign = FarPoint.Win.ButtonTextAlign.TextRightPictLeft;
- cktype.Caption = "男";
- FarPoint.Win.Spread.CellType.CheckBoxCellType cktype1 = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
- cktype1.TextAlign = FarPoint.Win.ButtonTextAlign.TextRightPictLeft;
- cktype1.Caption = "女";
- this.fpSpread1.Sheets[0].Cells[0, 1].CellType = cktype;
- this.fpSpread1.Sheets[0].Cells[0, 2].CellType = cktype1;
- this.fpSpread1.Sheets[0].Cells[0, 0].ForeColor = System.Drawing.Color.Red;
- this.fpSpread1.Sheets[0].Cells[0, 0].Text = "性别";
- this.fpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].ColumnSpan = 3;
- this.fpSpread1.Sheets[0].Columns[0].Border = new FarPoint.Win.LineBorder(Color.Gray, 1, true, true, false, true);
- this.fpSpread1.Sheets[0].Columns[1].Border = new FarPoint.Win.LineBorder(Color.Gray, 1, false, true, false, true);
- this.fpSpread1.Sheets[0].Columns[2].Border = new FarPoint.Win.LineBorder(Color.Gray, 1, false, true, true, true);
- }
复制代码 |