回复 3楼bingshang23的帖子
这需要结合几个事件来做,请参考:
- public Form1()
- {
- InitializeComponent();
- this.fpSpread1.Sheets[0].Cells[0, 0].BackColor = Color.Red;
- this.fpSpread1.CellClick += new FarPoint.Win.Spread.CellClickEventHandler(fpSpread1_CellClick);
- this.fpSpread1.ClipboardPasting += new FarPoint.Win.Spread.ClipboardPastingEventHandler(fpSpread1_ClipboardPasting);
- this.fpSpread1.ClipboardChanging += new EventHandler(fpSpread1_ClipboardChanging);
- }
- void fpSpread1_ClipboardPasting(object sender, FarPoint.Win.Spread.ClipboardPastingEventArgs e)
- {
- if (isHeaderFlag)
- {
- e.Handled = true;
- }
- }
- bool isHeaderFlag = false;
- bool isPasterFlat = false;
- void fpSpread1_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
- {
- if (e.ColumnHeader)
- {
- isHeaderFlag = true;
- }
- else
- {
- isHeaderFlag = false;
- }
- }
- void fpSpread1_ClipboardChanging(object sender, EventArgs e)
- {
- if (isHeaderFlag)
- {
- isPasterFlat = true;
- }
- }
复制代码
也许有些情况我没有考虑到,你再修改下应该没问题了。 |