JC.PAN 你好,根据 PSShape 位置取得单元格对象方法如下:- private void button2_Click(object sender, EventArgs e)
- {
- foreach (FarPoint.Win.Spread.DrawingSpace.PSShape item in this.fpSpread1.Sheets[0].DrawingContainer.ContainedObjects)
- {
- item.GetPictureRegion(item);
- //Shape 像素位置从 Cell[0,0] 计算,Cell 的像素位置从 SheetCorner 开始计算
- FarPoint.Win.Spread.Model.CellRange range = fpSpread1.GetCellFromPixel(0, 0,item.Left+ (int)(this.fpSpread1.Sheets[0].Columns[0].Width), item.Top + (int)(this.fpSpread1.Sheets[0].Rows[0].Height));
- listBox1.Items.Add("range: row=" + range.Row.ToString() + " column=" + range.Column.ToString());
- }
- }
复制代码 |