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;
}
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'シェイプオブジェクトを追加します
Dim a As New FarPoint.Win.Spread.DrawingSpace.ArrowShape
a.Name = "shape-a"
a.SetBounds(10, 10, 60, 60)
Dim b As New FarPoint.Win.Spread.DrawingSpace.BannerShape
b.Name = "shape-b"
b.SetBounds(90, 10, 60, 60)
Dim c As 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)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'シート上のシェイプオブジェクト数を取得します
Console.WriteLine(FpSpread1.ActiveSheet.DrawingContainer.ContainedObjects.Count())
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ps As FarPoint.Win.Spread.DrawingSpace.PSShape
For Each obj As FarPoint.Win.Spread.DrawingSpace.PSShape In FpSpread1.ActiveSheet.DrawingContainer.ContainedObjects
'各シェイプ名からGetShapeメソッド呼び出しによってオブジェクトを取得します
ps = FpSpread1.ActiveSheet.GetShape(CType(obj, FarPoint.Win.Spread.DrawingSpace.PSShape).Name)
'背景色を変更します
ps.BackColor = Color.Red
Next
End Sub