表单中加入一个浮动的图片
问题描述:如何在Spread中添加一个图片,浮动在单元格上部,可以任意移动位置并且调整大小。问题解答:Shape 提供了BackgroundImage用于获取或设置背景图片。
关键代码:
FarPoint.Win.Picture p = newPicture((Image)Properties.Resources.ResourceManager.GetObject("Tulips"));
p.Style = RenderStyle.Stretch;
FarPoint.Win.Spread.DrawingSpace.RectangleShape rShape = new FarPoint.Win.Spread.DrawingSpace.RectangleShape();
rShape.Name = "myRect1";
rShape.BackgroundImage = p;
rShape.Location = newPoint(20, 60);
rShape.Width = 100;
rShape.Height = 100;
fpSpread1.ActiveSheet.AddShape(rShape);
效果如图:
示例下载:点击下载
页:
[1]