GrapeCity SPREAD for Windows Forms 12.0J サンプルコード集 > シェイプ > 全てのシェイプを削除する |
シート上の全てのシェイプオブジェクトを削除する場合には、SheetViewクラスのClearShapesメソッド呼び出しを行います。
|
private void Form1_Load(object sender, System.EventArgs e) { //Arrowシェイプを追加します FarPoint.Win.Spread.DrawingSpace.ArrowShape arrow = new FarPoint.Win.Spread.DrawingSpace.ArrowShape(); arrow.Name = "Arrow-01"; arrow.BackColor = Color.Red; arrow.AlphaBlendBackColor = 90; arrow.ShadowColor = Color.Blue; arrow.AlphaBlendShadowColor = 90; arrow.ShadowDirection = FarPoint.Win.Spread.DrawingSpace.ShadowDirection.BottomRight; arrow.SetBounds(10, 10, 90, 60); fpSpread1.ActiveSheet.AddShape(arrow); //MultiSideシェイプを追加します FarPoint.Win.Spread.DrawingSpace.MultiSideShape ms = new FarPoint.Win.Spread.DrawingSpace.MultiSideShape(); ms.Sides = 5; ms.Name = "MultiSide-01"; ms.Text = "Multi"; ms.Font = new Font("Arial", 16); ms.CanRenderText = true; ms.MarginLeft = 0; //グラデーション設定 FarPoint.Win.Spread.DrawingSpace.PSGradient psg = new FarPoint.Win.Spread.DrawingSpace.PSGradient(); psg.Style = FarPoint.Win.Spread.DrawingSpace.GradientStyle.LinearTopDown; psg.Sections[0].Color = Color.Blue; psg.Sections[0].AlphaBlend = 128; psg.Sections[1].Color = Color.LightCyan; psg.Sections[1].AlphaBlend = 255; ms.Gradient = psg; ms.SetBounds(100, 60, 100, 100); fpSpread1.ActiveSheet.AddShape(ms); //UniversalNoシェイプを追加します FarPoint.Win.Spread.DrawingSpace.UniversalNoShape un = new FarPoint.Win.Spread.DrawingSpace.UniversalNoShape(); un.Name = "UniversalNo-01"; un.BackColor = Color.Red; un.ShadowColor = Color.Blue; un.SetBounds(230, 30, 100, 100); fpSpread1.ActiveSheet.AddShape(un); } private void button1_Click(object sender, System.EventArgs e) { //全てのシェイプを削除します fpSpread1.ActiveSheet.ClearShapes(); }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Arrowシェイプを追加します Dim arrow As New FarPoint.Win.Spread.DrawingSpace.ArrowShape arrow.Name = "Arrow-01" arrow.BackColor = Color.Red arrow.AlphaBlendBackColor = 90 arrow.ShadowColor = Color.Blue arrow.AlphaBlendShadowColor = 90 arrow.ShadowDirection = FarPoint.Win.Spread.DrawingSpace.ShadowDirection.BottomRight arrow.SetBounds(10, 10, 90, 60) FpSpread1.ActiveSheet.AddShape(arrow) 'MultiSideシェイプを追加します Dim ms As New FarPoint.Win.Spread.DrawingSpace.MultiSideShape ms.Sides = 5 ms.Name = "MultiSide-01" ms.Text = "Multi" ms.Font = New Font("Arial", 16) ms.CanRenderText = True ms.MarginLeft = 0 'グラデーション設定 Dim psg As New FarPoint.Win.Spread.DrawingSpace.PSGradient psg.Style = FarPoint.Win.Spread.DrawingSpace.GradientStyle.LinearTopDown psg.Sections(0).Color = Color.Blue psg.Sections(0).AlphaBlend = 128 psg.Sections(1).Color = Color.LightCyan psg.Sections(1).AlphaBlend = 255 ms.Gradient = psg ms.SetBounds(100, 60, 100, 100) FpSpread1.ActiveSheet.AddShape(ms) 'UniversalNoシェイプを追加します Dim un As New FarPoint.Win.Spread.DrawingSpace.UniversalNoShape un.Name = "UniversalNo-01" un.BackColor = Color.Red un.ShadowColor = Color.Blue un.SetBounds(230, 30, 100, 100) FpSpread1.ActiveSheet.AddShape(un) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) '全てのシェイプを削除します FpSpread1.ActiveSheet.ClearShapes() End Sub