回复 1楼youitlyang的帖子
请参考以下代码:
- private void Form1_Load(object sender, EventArgs e)
- {
- FarPoint.Win.Spread.CellType.ImageCellType imgct = new FarPoint.Win.Spread.CellType.ImageCellType();
- System.Drawing.Image image = System.Drawing.Image.FromFile("Man.png");
- imgct.Style = FarPoint.Win.RenderStyle.Stretch;
- imgct.TransparencyColor = Color.Black;
- imgct.TransparencyTolerance = 20;
- fpSpread1.Sheets[0].Columns[1, 2].Width = 100;
- fpSpread1.Sheets[0].Rows[1, 1].Height = 50;
- fpSpread1.Sheets[0].Cells[1, 1].CellType = imgct;
- fpSpread1.Sheets[0].Cells[1, 1].Value = image;
- }
- private void fpSpread1_CellDoubleClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
- {
- if (fpSpread1.ActiveSheet.ActiveCell.CellType is FarPoint.Win.Spread.CellType.ImageCellType)
- {
- OpenFileDialog dlgOpen = new OpenFileDialog();
- dlgOpen.Filter = "*.jpeg|*.png";
- if (dlgOpen.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- fpSpread1.ActiveSheet.ActiveCell.Value = System.Drawing.Image.FromFile(dlgOpen.FileName);
- }
- }
- }
复制代码 |