spread 实现EXCEL某些效果这个帖子中第4个问题,当初dof回答我让我使用ComponentOne Studio for WinForms 产品的
C1TEXTBOX
我现在使用了,测试代码如下:
- private void Custom_ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- CTextCellType txt = new CTextCellType();
- fpSpread1.ActiveSheet.Columns[0].CellType = txt;
- fpSpread1.ActiveSheet.Columns[0].VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;
- fpSpread1.ActiveSheet.Columns[0].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
- }
- public class CTextCellType : FarPoint.Win.Spread.CellType.GeneralCellType
- {
- C1.Win.C1Input.C1TextBox txt = null;
- public CTextCellType()
- {
- txt = new C1.Win.C1Input.C1TextBox();
- txt.VerticalAlign = C1.Win.C1Input.VerticalAlignEnum.Middle;
- txt.TextAlign = HorizontalAlignment.Center;
- txt.LostFocus += new EventHandler(txt_LostFocus);
- }
- void txt_LostFocus(object sender, EventArgs e)
- {
- C1.Win.C1Input.C1TextBox txt = sender as C1.Win.C1Input.C1TextBox;
- txt.Multiline = true;
- FarPoint.Win.Spread.FpSpread spread = txt.Parent as FarPoint.Win.Spread.FpSpread;
- spread.ActiveSheet.ActiveCell.Value = txt.Text;
- }
- public override Control GetEditorControl(Control parent, FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
- {
- return txt;
- }
- public override object GetEditorValue()
- {
- return txt.Text;
- }
- public override void SetEditorValue(object value)
- {
- txt.Value = value;
- }
- }
复制代码
我现在想实现以下两个效果
1.回车时单元格内换行,现在回车,直接跳到另一个单元格
2.如何设置单元格内的行间距?
由于第一次使用C1TEXTBOX,请各位多多帮助..
谢谢先 |
|