回复 1楼fmyuan2000的帖子
亲,不是特别理解你的需求,但是你可以参考如下代码,也许对你有帮助。
private void Form1_Load(object sender, System.EventArgs e)
{
//シェイプオブジェクトを追加します
FarPoint.Win.Spread.DrawingSpace.ArrowShape a = new FarPoint.Win.Spread.DrawingSpace.ArrowShape();
a.Name = "shape-a";
a.SetBounds(10, 10, 60, 60);
FarPoint.Win.Spread.DrawingSpace.BannerShape b = new FarPoint.Win.Spread.DrawingSpace.BannerShape();
b.Name = "shape-b";
b.SetBounds(90, 10, 60, 60);
FarPoint.Win.Spread.DrawingSpace.BurstShape c = new FarPoint.Win.Spread.DrawingSpace.BurstShape();
c.Name = "shape-c";
c.SetBounds(180, 10, 60, 60);
fpSpread1.ActiveSheet.AddShape(a);
fpSpread1.ActiveSheet.AddShape(b);
fpSpread1.ActiveSheet.AddShape(c);
}
private void button1_Click(object sender, System.EventArgs e)
{
//シート上のシェイプオブジェクト数を取得します
Console.WriteLine(fpSpread1.ActiveSheet.DrawingContainer.ContainedObjects.Count);
}
private void button2_Click(object sender, System.EventArgs e)
{
FarPoint.Win.Spread.DrawingSpace.PSShape ps;
foreach (FarPoint.Win.Spread.DrawingSpace.PSShape obj in fpSpread1.ActiveSheet.DrawingContainer.ContainedObjects)
{
//各シェイプ名からGetShapeメソッド呼び出しによってオブジェクトを取得します
ps = fpSpread1.ActiveSheet.GetShape(((FarPoint.Win.Spread.DrawingSpace.PSShape)(obj)).Name);
//背景色を変更します
ps.BackColor = Color.Red;
}
} |