Farpoint Spread 2005 的一些用法

FpSpread命名﹕sgrid1

1. 設置表格行列標題的背景顏色

sgrid1_Sheet1.RowHeader.DefaultStyle.BackColor =

Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));


sgrid1_Sheet1.ColumnHeader.DefaultStyle.BackColor =

Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));


sgrid1_Sheet1.SheetCornerStyle.BackColor =

Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));

 

 2. 設置列的樣式

//將第一列設置成設置成"選擇框"

sgrid1.Sheets[0].Columns[0].CellType

= new FarPoint.Win.Spread.CellType.CheckBoxCellType();

//"選擇框"居中
sgrid1.Sheets[0].Columns[0].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;

 

//將第一列設置成設置成"組合下拉框",并填充值

 

DataSet ds = new DataSet();
string sql = "";            
string str = "";
string[] strItem;

 

 sql = "Select Status_Descc From A_OrderStatus with(nolock) ";
 ds = ; //獲取 dataset 至于如何填充ds﹐這里就不寫了
 strItem = new string[ds.Tables[0].Rows.Count];  //數組長度
 foreach (DataRow dr in ds.Tables[0].Rows)
            {
                str = str + dr["Status_Desc"].ToString().Trim() + ",";
            }
 strItem = str.Split(new char[1] { ',' });
 FarPoint.Win.Spread.CellType.ComboBoxCellType cb =

 new FarPoint.Win.Spread.CellType.ComboBoxCellType();
 

 cb.Items = strItem;
 sgrid1.Sheets[0].Columns[(int)V1.status_descc].CellType = cb;

 

 

 

3.鼠標點擊時整行選擇

sgrid1.ActiveSheet.SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row;

 

4.按回車時 FarSpread 默認是不移動的﹐我們一般需要向右移動

   需要這樣設置﹕

FarPoint.Win.Spread.InputMap im;
im = sgrid1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
           

im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None),

 FarPoint.Win.Spread.SpreadActions.MoveToNextColumnWrap);
           

im = sgrid1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
           

im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextColumnWrap);

 

5. 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SAP道长

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值